mark-wiemer-org/ahkpp

[v2] Add formatting support

Opened this issue · 4 comments

Is your feature request related to a problem? Please describe.
Currently, v2 support doesn't have formatting enabled by default. Please enable formatting for AHK v2 scripts.

Describe the solution you'd like
When I try to format an AHK v2 script, it works.

Describe alternatives you've considered
I have to use another extension to format AHK v2 scripts.

Notes
It is not currently possible to configure AHK++ to format AHK v2 scripts even if I want to do so :(

Note: leaving this out of the initial preview release because thqby's formatter is 6,000+ lines long! I'll consider adding basic support using the existing formatter, but step 1 is actually releasing something, and formatting isn't critical :)

Formatting and snippets are both underway, I'm working on cleaning up thqby's code.

Then I'll add tests and work to integrate it with the existing project :)

Ref https://github.com/mark-wiemer-org/vscode-autohotkey2-lsp

Hey folks, terribly sorry for the delay. Let's just say life's been a bit busy. In any case, I am here and this is definitely the next big feature to come. But there is a lot of code to clean up!

If there is great demand, I can open experimental formatting support using the existing v1 formatter for simple scripts, but it'll have plenty of disclaimers explaining that there will likely be bugs and it's not recommended for large scripts.

Ref the following code, we are only assigning a formatting provider for the v1 language, though it'd be trivial to add one for v2.

ahkpp/src/extension.ts

Lines 54 to 57 in 70bab81

vscode.languages.registerDocumentFormattingEditProvider(
language,
new FormatProvider(),
),

Current plan is to integrate code formatting, linting, and unit tests into thqby's repo, then I can start to integrate that code into my repo as a submodule. That way everyone benefits :) ref thqby/vscode-autohotkey2-lsp#531