How to debug a VSCode extension - visual-studio-code

I'm trying to write an extension for VSCode, however I'm having all sorts of problems in that part of the extension doesn't appear to be recognised.
The extension is in two parts, a grammar and languages part -- this is recognised and is working well.
The second part is a debugger, but I cannot get VSCode to see this. There is obviously an error somewhere in my package.json, but I cannot find an error message anywhere.
Is there anyway to validate the package.json file? Or the solution as a whole? Hitting F5 starts up a child VSCode, but no errors. Looking in the extensions tab, it doesn't show that there is a debugger in the extension, so it must be the wrong configuration?

Related

VSCode SCSS extension with better error checking

I recently started writing SCSS in VSCode. VSCode itself along with vscode-scss extension provides relatively good support for SCSS, but an important feature seems missing - error checking.
Though VSCode and vscode-scss can offer suggestions through Intellisense based on scanning, no errors will be prompted if I misspelled a variable, or used a mixin that hadn't been imported yet. Also, no auto refactoring takes place after renaming an SCSS file that has been used by other sources.
Is there any VSCode extension that provides such validations? Or maybe they can be turned on through some options in extension settings?
Note: I do have noticed the scss.showErrors option of vscode-scss, but no errors get prompted in scenarios mentioned above after turning this option on.

How to make custom changes to a VSCode extension directly from the extensions folder

Good day. I have a third-party VSCode extension that's been throwing an error all day. In order to actually diagnose this, and then submit an issue on the parent GitHub repository, I've been poking around and trying to figure out where the error is being thrown from.
I have a decent idea where the error is originating from, but I'd like to add a console.debug statements to confirm this.
My question is this: I've made changes to the actual VSCode extension source code (installed within the VSCode extensions folder ), but VSCode is not picking up those changes. What do I do? Clean the cache or something, I'm not quite sure.
The source file is basically just a Ts-compiled-to-JS file, so still pretty easy to work with.
I've checked out the Developer Tools Console (Ctrl+Shift+I), but the error stack is not particularly helpful.

Adding the run-code option to a new language in VSCode

I'm currently writing my own language and I'm at a point where I would like to publish it to the VSCode-Marketplace so people can test it.
I have written a language extension and a syntax highlighter with the Yeoman-Generator and now want to merge it with my executable file that launches the interpreter, so that a file can get interpreted after clicking the run-code button.
I now have checked multiple articles, like:
How to add a run button in visual studio code? - StackOverflow
How to define or support a code language on Visual Studio? - StackOverflow
Debugger Extension Guide - VSCode API
However, I haven't found anything useful.
Currently, the code-runner displays the following error, when clicking on run, or pressing the shortcut:
(Code language not supported or defined.)
But even after a lot of browsing Google for adding new language support to the code-runner, I found absolutely nothing helpful.
(See this page, idk what Settings/Preferences they are referring to!?)
I also was not successful with tasks, as they don't seem to connect to the run-buttom or debug-button in any way.
My question is: How can I make the run-button execute a custom bash-command, when a file in my language is opened?
Okay, I finally did it.
For anyone wondering:
You have to go to the settings and type "code-runner" into the search bar.
Scroll down a little, and you should find the code runner-executor map.
Click on the "edit in settings.json" button.
Now a .json-file should've opened. There are two possible scenarios: Either, there is a json-object called code-runner.executorMapBy... or not.
If there is none, type code-runner.executorMapByFileExtension and let autocomplete do the job.
If the json-object exists, add the file-extension and a bash command that executes your compiler/interpreter. It gets automatically executed in the directory the program-file lies in.
Now still dont know, how to include the settings in my extension, but that was already a big step. Further help is still appreciated!
There is an open source extension called code runner, you can check source code there.

vscode invalid syntax error for dart and flutter after pressing the Ctrl+Shift+I short to format the code in readable form

I am using vscode in ubuntu for developing flutter application. I installed the flutter and dart extension for vscode. when I write code and keep it the same dirty format it doesn't take any syntax error -although it shouldn't- but after I reformat the code in a readable shape using Ctrl+Shift+i short-key vscode takes syntax error. However, when I close the file (here the .dart file) and re-open it, all errors is gone. You can see it more in the picture.
I don't know how to handle this kinda error.
I would guess you have the Laravel Blade Spacer extension installed. This extension accidentally reverses the order of edits when handling a document edit event. VS Code then passes that mutated set of changes to other extensions (like Dart) which end up making incorrect edits (in this case, that are sent to the language server, so it gets an incorrect picture of what the file looks like).
This was fixed in VS Code (by preventing mutations to the array) in https://github.com/microsoft/vscode/issues/88310, but has yet to be released.
For now, you'll need to either disable that extension or use VS Code Insiders. Once the next stable version of VS Code is out, the issue should disappear.

How to cripple the prompt message in vscode

I read my project code in vs code. However, I don't have to run it and thus I choose not to configure it. Unfortunately, each time I hit a file window, vs code would show me a error message. What's more, the message window rightly holds up my toolbar. It is annoying! >_<
How can I disable the function of showing error message?
I will appreciate it if someone could give me some advice.
This is coming the clang-format extension. You should disable this extension if you are not going to use it or configure it.
The error is expected and correct in this case as that extension will not work without a valid clang executable