VSCode syntax highlighting not working for my project
My apologies for creating an issue. I'm not sure how best to reach out for support.
I can't seem to get syntax highlighting via the textX VSCode extension to work for my custom language. Here's a screenshot to show how far I've gotten.
- I've installed the v0.1.2 of the
textXextension from the marketplace. (latest published) - My language package depends on v0.1.1 of the
textx-ls-corepackage. (latest published) - I can successfully register the language with the
textxcommand from the Terminal. - I can successfully install the language to the extension as a "textX project" in VSCode, using both the
setup.pyand.whlstyles. - But when I go to "select a language mode" in VSCode (Ctrl + Shift + L), I don't see my custom language.
What am I missing?
Hello, this is the best and only way for now, no need to apologise! :)
Could you point me to your project (if it is an open-source) and I will try it on my end?
From what I can see, it might be an issue with the file extension that you are using. I haven't tried multiple file extensions (.tsdoc.py), so it might be a bug.
Could you try just .tsdoc and if that works I will try to find the issue with multiple extensions.
Could you point me to your project (if it is an open-source) and I will try it on my end?
That would be super helpful. It's not open source, but I just invited you as a collaborator.
From what I can see, it might be an issue with the file extension that you are using. I haven't tried multiple file extensions (.tsdoc.py), so it might be a bug. Could you try just .tsdoc and if that works I will try to find the issue with multiple extensions.
Good thought. Unfortunately, that didn't seem to fix the problem. Though it could be one of the problems!
If possible, I'd like to keep the multiple file extension as the language I'm working on is an embedded comment language for Python (and potentially other languages). My hope was to leverage VSCode's grammar injection feature.
Ping.
TL;DR: Without NodeJS installed (in PATH), the language extension cannot get generated (and installed). @ryansobol: Do you have NodeJS installed?
The client creates a VSIX file and installs it: https://github.com/textX/textX-LS/blob/0940a66fb264c7c20f046062606ca6a29af19056/client/src/services/generatorService.ts#L40
In order to create the VSIX file - after some intermediate steps - vsce gets called, whichs needs the NodeJS runtime. However, it is not bundled with VS Code.
@danixeee: Wouldn't it way easier to generate directly into .vscode/extensions/textx.my_lang-X.Y.Z?
@danixeee: Or a an (optional) vsix packager that can be used as a drop-in. The generated VSIX file is just a zip file with two additional manifests..
vsce is packaged and shipped within the textX extension.

The problem with tsdoc extension was that some characters were not escaped correctly while generating textmate json. It's still an issue, but I didn't have time to resolve it.
On the other hand, I agree that it would be cleaner to have a vsce implementation in python, but I think that it should go to a separate repository.
@ipa-mdl What are your thoughts?
vsce is packaged and shipped within the textX extension.
Yes, but it needs NodeJS installed to work. (at least on Windows)
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\node_modules\vsce\out\vsce" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\node_modules\vsce\out\vsce" %*
)
https://github.com/danixeee/textx-gen-vscode/pull/7 is a pure python implementation, which generates the same VSIX content as vsce would (given the templated extension).
I tested it together with #42 on Windows and Linux
TL;DR: Without NodeJS installed (in PATH), the language extension cannot get generated (and installed). @ryansobol: Do you have NodeJS installed?
Yes
~ $ echo $PATH
/usr/local/opt/[email protected]/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Library/Apple/usr/bin
~ $ node --version
v14.7.0
Yes
Ah, so indeed your problem is not related to NodeJs. Sorry for the noise. It just looked identical.
@danixeee: We should move the discussion to https://github.com/danixeee/textx-gen-vscode/pull/7 then.
The problem with tsdoc extension was that some characters were not escaped correctly while generating textmate json. It's still an issue, but I didn't have time to resolve it.
Nevertheless, it should be tracked as an issue in https://github.com/danixeee/textx-gen-coloring