customasm icon indicating copy to clipboard operation
customasm copied to clipboard

Language Server for VSCode or other popular IDE's

Open ghost opened this issue 3 years ago • 5 comments

After working on a rather stupidly large project, I find myself wishing for autocompletion and syntax highlighting to make my life easier. This is a suggestion/request to have someone make this possible.

ghost avatar Aug 22 '21 12:08 ghost

how would that even work? it's a universal assembler, so it's impossible to create any kind of highlighting that would work for any possible CPU you could describe with the Assembler.

the best option you have is to just create your own highlighting for whatever CPU you're working with, or using an IDE that already supports it if you're working with an existing Processor like the 6502, Z80, 68k, ARM, etc

personally i use NP++ as my IDE, and it gives you the ability to add custom highlighting for any custom language. so for any CPU i use CustomASM for, i have also made custom highlighting for. it's fairly easy as well, since most of the time only Instruction Mnemonics and Register names are changing between different Processors. so i can just make highlighting for a new CPU by just importing the XML file (format used by NP++ to store the custom highlight) for some other Processor, tweak those things mentioned above, and then export it with a new name.

ProxyPlayerHD avatar Aug 26 '21 00:08 ProxyPlayerHD

I think it would indeed be a little difficult to statically decide what's a valid instruction and what's not, but we could just run the assembler over the source files and make it return some kind of syntax report that could be used for highlighting purposes. Now, for autocompletion, I'm not sure how that could work...

In any case, I think doing a Language Server would require the assembler to work off of a configuration file (like package.json or tsconfig.json), which is another thing we'll have to work on!

hlorenzi avatar Aug 26 '21 12:08 hlorenzi

Yeah, it would be a bit difficult, especially because of how complex the assembler is. I would use notepad++, but its not available under linux right now. This honestly seems complicated enough to warrant a separate project. Somehow the assembler knows how to match instructions, so it might be a good idea to start the autocompletion/highlighting there.

ghost avatar Aug 28 '21 13:08 ghost

I don't know if you're already using the VSCode basic highlighting extension, but it does more or less what Notepad++ would do.

hlorenzi avatar Aug 28 '21 14:08 hlorenzi

I wrote a syntax definition for Sublime Text: https://github.com/parasyte/sublime-syntax-customasm It is fairly complete, but I'm not certain of its accuracy. (See also #139 which would provide a great reference for improving the accuracy of the syntax parser.)

parasyte avatar Jul 12 '22 05:07 parasyte