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

VSCode syntax highlighting not working for my project #36

Open
ryansobol opened this issue Apr 30, 2020 · 9 comments
Open

VSCode syntax highlighting not working for my project #36

ryansobol opened this issue Apr 30, 2020 · 9 comments

Comments

@ryansobol
Copy link

ryansobol commented Apr 30, 2020

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.

Screen Shot 2020-04-30 at 09 55 13

  • I've installed the v0.1.2 of the textX extension from the marketplace. (latest published)
  • My language package depends on v0.1.1 of the textx-ls-core package. (latest published)
  • I can successfully register the language with the textx command from the Terminal.
  • I can successfully install the language to the extension as a "textX project" in VSCode, using both the setup.py and .whl styles.
  • 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?

@danixeee
Copy link
Member

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.

@ryansobol
Copy link
Author

ryansobol commented Apr 30, 2020

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.

@ryansobol
Copy link
Author

Ping.

@mathias-luedtke
Copy link

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:

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?

@mathias-luedtke
Copy link

@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..

@danixeee
Copy link
Member

vsce is packaged and shipped within the textX extension.

image

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?

@mathias-luedtke
Copy link

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" %*
)

danixeee/textx-gen-vscode#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

@ryansobol
Copy link
Author

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

@mathias-luedtke
Copy link

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 danixeee/textx-gen-vscode#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants