-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add the possibility to create a standalone LSP for a particular textx-DSL #4
Comments
Hello Pierre, I saw your contribution on the textX project, great work! Did you see the other repository (textx-vscode) where we are working on a vscode extension which communicates with textx-ls? I have just added one more example where you can see how to add a path to your python module with custom classes and builtins. You can also generate, pack, and use a custom extension for your DSL with syntax coloring and other features. You can see commands list here. I plan to write detail description about LS implementation, so interested people can contribute. Meanwhile, feel free to ask me all you want to know. Thanks, |
Nice work you did. I need more time to understand more of it. I try to figure out how to include scoping and validation into the lsp. I think your solution for the buildins and custom classes is a good idea... I will observe your next steps. Happy coding. |
Hi Pierre, I have added model and object processors as well as match filters. Implementation is similar to custom classes and builtins. Cheers |
Hi.
I am not familiar with the vscode extensions. I will have a look next week. maybe you have a hint. |
Hi. I located the effect in "vscode_generator.py", when passing the line "if '.vscode' not in this_folder:". Where is the ".vscode" meant to be? Or how do I create it? Best wishes. |
Hi, sorry for the late response. Generating a new extension has a lot of issues, I will need more time to fix that command, or change complete logic behind it. When you install any vs-code extension, it is placed in a directory which has the following path: .../.vscode/extensions/AUTHOR.NAME_OF_EXT-VERSION. When generating a new extension, my idea was to copy the already installed textx-ls extension from .vscode/extensions directory, create txconfig directory and then copy all the files needed for the new defined language (.txconfig, outline, coloring, icons, etc) there. After all that, paths from all those files should be changed (path to grammar, path to icons in outline file, etc.). So, that's why I have added this check "if '.vscode' not in this_folder:", to be sure that all files needed for a new extension are there. The best way to debug and develop the language server is:
{
"name": "Debug LS",
"type": "python",
"pythonPath":"${config:python.pythonPath}",
"request": "launch",
"stopOnEntry": true,
"console": "none",
"program": "${workspaceFolder}/__main__.py",
"args": [
"--tcp"
],
"cwd": "${workspaceFolder}",
"debugOptions": [
"RedirectOutput"
]
}
This might be confusing, but once you setup all that, it should be easy to debug and see what's happening there. Thanks for your interest and all suggestions are welcome! |
Dear danixeee,
I would like to use or extend (work on it) your language server implementation. I recently started to work in the textX project.
I see the necessity to include the full metamodel of a textX language in the LSP (not only the grammar, possibly enriched with user classes or similar). I would like this to happen, because I think aspects like scoping or validation (through object processors) play a central role.
I could image to provide supporting functions in your repository to ease the creation of a LS (e.g, through a library function call: textXls.runLS(metamodel_instance)). Moreover, I would like add support for the integration in different editors, such as vscode, by adding simple generators to create the code for the extension for the editor. With this, a standalone extension + LSP could be shipped with a textX-language, e.g., starting a textX-compiler/generator (e.g. “recipec”) with a special flag: “recipec –lsp” for the LSP implementation and “recipec –generate-vscode-extension” for the vscode integration).
I would be happy to get some feedback from you about your plans, and – if there are no reasons against it – to get some hint where to start: I was just stumbling about how to integrate your code in vscode…
Best,
Pierre
The text was updated successfully, but these errors were encountered: