'Create formatter in Visual Studio Code
When I try to auto indent my .ahk files, I get "There is no formatter for 'ahk'-files installed." How can I create a rudimentary formatter?
Solution 1:[1]
The approach is the same like for any other language/file specific extensions in vscode: you have to create an extension and register the providers for the features you want to support, e.g. references provider, symbol provider etc. In your case you have to implement a formatting provider, see here how I did it in my extension. In order use it in vscode you have to register it in your main extension file. That looks like:
context.subscriptions.push(languages.registerDocumentRangeFormattingEditProvider(ANTLR, new AntlrFormattingProvider(backend)));
I recommend reading up about how to create an extension for vscode before you actually start the formatting provider. Here's a good description of the first steps: https://code.visualstudio.com/api/get-started/your-first-extension
Solution 2:[2]
Sorry - at time of writing, this just doesn't exist for VS Code.
The closest you'd get is to keep an eye on the main autohotkey extension for VS Code here:
https://github.com/stef-levesque/vscode-autohotkey
It may be worth putting a request in on that github repository requesting formatting features be added to the extension.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Simon C |