couple of weeks ago I installed Visual Studio Code on my Windows machine. It is lightweight and I love it. But there is one problem that drives me crazy. The program cannot format .cs files. If I open .Net Core project, there is no problem on formatting. I changed the language from bottom right to C# and saved the file locally still no success. Is there any way to format code in single .cs file? I know there is already an asked question here for this problem but the solutions does not apply if there is no project created.
Use the command pallet (crtl-shift-P), type "format" and select "format code". Assuming the extension for the current language supports that.
TypeScript does, but C# does not.
You could raise an issue (if one does not already exist).
Related
I’ve been using Dymola (version 2017) for three months and I’d just like to ask a simple issue that I think about it nearly every day. Is there any difference between the file tool “Open” and “Load"? I'm used to use Load for “load” the library packages and Open for “open” the model files, but I've tried to switch them few times and I didn’t notice any difference. I guess that it isn’t relevant and actually it’s just out of curiosity, but maybe someone in this community is able to shed some light on why there are two buttons. Thanks in advance.
Both load your .mo files into the package browser. But Open changes the working directory to the location of the .mo file, whereas Load does not.
From the command line:
openModel("lib.mo", changeDirectory=false) // corresponds to load
openModel("lib.mo") // corresponds to open
You can check your current working directory by typing cd on the command line.
I'm using Visual Studio Code for development of PHP and would like to style the background color of the different embedded languages HTML/PHP/JavaScript differently, and to trigger the use of heredoc <<<sql .... sql to switch to SQL syntax. From what I can see from VSCode documentation, I need to edit the grammar files stored in storage.json, but for the life of me I cannot find where those files are. Can anyone point me in the right direction?
Sumirizing our comments, in order to modify the extension files, try to access the following folder:
./yourVSCodeFolder/extensions/resources/app/extensions
As you said, for those in windows, that folder is in:
%LocalAppData%\Programs\Microsoft VS Code\resources\app\extensions\php
There you will find a lot of folders that contains JSON files with the instructions of the custom formats and snippets that your editor uses.
For example: in mine, the /syntax/php.tmLanguage.json has all the instructions for how my php should look, and php/language-configuration.json has some parsing rules.
Find the files that allready has the rules that you are looking for, but it could be tricky because maybe you will need a prettyfier and to link or create new rules.
Also, if you didn't, check the Language Extensions Guide that VSCode provides.
Hope it was useful.
PD: As you also said:
VSCode already recognizes embedded SQL as long as the heredoc is in upper case <<<SQL .... SQL
Currently, I name my files as .py while working on them, and then change them to .sage when I need to execute. Is there a way to get the python colour scheme for sage files on VS code?
There is an extension called SAGE enterprise management that claims to do it, but the instructions are a bit unclear:
It says:
Create a x3-code named folder inside your ~/.vscode/extensions/;
Copy all files in yours recent created folder;
Reload VS Code and enjoy;
I tried both copying my sage files into the folder, and the contents of the x3-extension into the folder, both of which didn't work.
The instructions referred to in the question are for Sage the
accounting software, not for SageMath the Sage mathematics
software system.
In the case of SageMath, we need to tell VS Code to apply Python
formatting not only to files ending in .py, but also to files
ending in .sage. One way to do that is to use the "file to
language association" setting:
https://code.visualstudio.com/updates/vMarch#_file-to-language-association
One would add associations from "*.sage" to "python".
This related question has answers explaining where Visual
Studio Code's language extension files are located on macOS
and Windows:
Stack Overflow question 42498117
Following the first link provided in the prior answer, I got it worked. In details,
go to Settings, type "files.associations" in the search box for Search settings.
It shows you a list of (item, value) in which you can add a new item (*.sage, python). See my screenshot below
Hope it works for you!
I've been working on some scripts for Windows using Visual Studio Code and was surprised that when I type WScript on a line the IntelliSense pops up the correct code completion information, even on my Mac.
I've read the documentation on the VSC website and suspect its either coming out of the built-in JavaScript support or Automatic Type Acquisition from some included library but really would like to find out exactly where this is coming from. So far either my Google-Fu is or nobody has written a thing about it because I can't find any information anywhere. Can anyone answer this one?
It's built into TypeScript. In VSCode, it's actually easy to find the source because you can press F12 on the definition in code, and it will show you the .d.ts:
When I first started using Visual Studio Code for my cobol, it was working fine. But lately when I try to compile my code after saving it in vsc it gives errors about there being weird characters.
If I do the same changes in Notepad++ it works fine. I've been going through the settings in vsc but I cannot find anything wrong in there. But then again I don't know that much about it. I'm also using the extension cobol syntax support from bitlang.
Does anybody know how this is possible? Is there some setting that messes this up? I cannot really show any screens or anything. since this is all work related and I'm not allowed to share.
My guess is, that this is related to the code page used to save the project.
Notepad++ by default uses UTF-8. you may need to change the code page on Visual Studio Code to UTF-8.
https://code.visualstudio.com/docs/getstarted/settings