Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No formatter AHK2 script in VS Code #444

Closed
tirosko opened this issue May 26, 2024 · 7 comments
Closed

No formatter AHK2 script in VS Code #444

tirosko opened this issue May 26, 2024 · 7 comments
Assignees
Labels
bug something isn't working

Comments

@tirosko
Copy link

tirosko commented May 26, 2024

Description

After Ctrl+Shilt+P (open palete - Format document.
Appear request to install formatter

Please see attached file.

Contact mail: [email protected]
Snímka obrazovky 2024-05-26 125746

@tirosko tirosko added the bug something isn't working label May 26, 2024
@mark-wiemer
Copy link
Owner

Ref #445, let me know if this helps :)

@tirosko
Copy link
Author

tirosko commented May 26, 2024 via email

@Lootwig
Copy link

Lootwig commented Jun 6, 2024

That assigns the v1 type though, shouldn't the "ahk2" type still be picked up by VS Code? I can't even assign an unsupported formatter to the type, I still get the "no installed formatter" box

// settings.json
{
  "files.associations": {
    "*.ahk": "ahk2"
  },
  "[ahk2]": {
    "editor.defaultFormatter": "mark-wiemer.vscode-autohotkey-plus-plus" // doesn't even attempt to use, independent of e.g. "prettier" or anything else
  },
}

@mark-wiemer
Copy link
Owner

mark-wiemer commented Jun 8, 2024

@Lootwig, I understand the frustration, and I'll go ahead and enable experimental v2 support to unblock simple scripts, but please be aware that there will be many, many bugs noticeable on larger scripts. Ref #381 for details.

@Lootwig
Copy link

Lootwig commented Jun 8, 2024

@mark-wiemer relax, the frustration is within reasonable limits :D

The main inconvenience isn't really the wip-status of v2, but the fact that the extension recognizes the language, VS code lists ahk++ after offering to search for formatters, and I spent an embarrassing amount of time trying to figure out why the message is "no installed formatter" even after manual assignment, instead of something more specific like when attempting to assign the "dart" formatter:

image

It might be commonly known that "contributing a language" and having "formatters" as one of the categories of an extension may not mean there's a formatter for all contributed languages - I just didn't know and if you feel like language support just isn't ready enough, simply disabling the ahk2 type would be a totally acceptable remedy for the cause of my confusion!

@mark-wiemer
Copy link
Owner

Let me see if there's an easy way around this. I don't think it's as simple as "disabling the ahk2 type" as I do want to keep that: the extension uses the type to determine which AHK runtime to use and which icon to render (blue for v1, green for v2). I found this and am investigating now:

https://github.com/microsoft/vscode/blob/d2d053d84e2460661c435ac825b1b1895f7efd51/src/vs/workbench/contrib/format/browser/formatActionsMultiple.ts#L130

@mark-wiemer
Copy link
Owner

mark-wiemer commented Jun 9, 2024

Hmm, @Lootwig I'm not able to reproduce your issue:

image

// settings.json
"[ahk2]": {
  "editor.defaultFormatter": "mark-wiemer.vscode-autohotkey-plus-plus"
},

Repro steps: Open a .ahk2 file and try run > Format Document via command palette (Ctrl+P)

I also don't see AHK++ in the list of formatters when I run > Format With...:

image

For now I'm not seeing anything wrong with the extension. There is a bit of AHK v2 support, but I'll try to update the readme to be clearer about the limitations. I am working towards adding full formatting support though :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants