dan-c-underwood / vscode-arm

Arm® Syntax highlighting for VSCode
MIT License
41 stars 19 forks source link

Feature request: option to use // rather than @ for line comments #32

Open dgazzoni opened 2 years ago

dgazzoni commented 2 years ago

I'd like to use the Edit -> Toggle Line Comment command (or, more specifically, its shortcut Cmd+/) to comment lines in my code. However, this prefixes the line with @, which is not treated as a comment in my setup (Linux, AArch64 assembly, .S files which go through preprocessing) and thus fails to assemble. Instead, a comment needs to start with //.

Would it be possible to create a setting to select the comment style to use, @ or //?

dan-c-underwood commented 2 years ago

Hey - this relates to https://github.com/dan-c-underwood/vscode-arm/issues/19. Unfortunately, syntax grammars are pretty limited in their functionality - there's no way to swap between comment characters for example (which is fine for most languages! but there are so many variants of toolchains in the assembly space).

How are ; handled in your setup? As that matches what the Arm Compiler reference expects and might be a reasonable compromise: https://developer.arm.com/documentation/dui0473/m/structure-of-assembly-language-modules/syntax-of-source-lines-in-assembly-language

If it doesn't work, I'm open to swapping over to // but I'll have to look at what Arm projects generally use.

dgazzoni commented 2 years ago

I just tried ; and it didn't work here -- I recall reading that ; is used by gas somewhat like the C pre-processor uses \ .

However, # does work.

dan-c-underwood commented 2 years ago

Sorry for the delay in getting back on this. I did try some experimentation (including the package offering a multiple per-compiler versions of the language, however it doesn't function reliably! (VS Code was randomly, per-load, picking which comment style to use no matter which language was manually selected). I'll continue investigating this - but in the short term, this extension looks like it might meet customisation needs: https://github.com/ArturoDent/custom-language-properties

I'll update here if I work out a cleaner solution.

dan-c-underwood commented 2 years ago

Also - there's this open issue on the VSCode repo - it may be useful expressing interest in this capability over there, as that would be the cleanest solution! 😄

https://github.com/microsoft/vscode/issues/64659