{"id":13340375,"url":"https://github.com/NaoMod/XText-Language-Server-in-VSCode","last_synced_at":"2025-03-11T17:30:39.932Z","repository":{"id":93452237,"uuid":"460519681","full_name":"NaoMod/XText-Language-Server-in-VSCode","owner":"NaoMod","description":null,"archived":false,"fork":false,"pushed_at":"2022-03-10T09:11:30.000Z","size":15073,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-24T04:28:40.380Z","etag":null,"topics":["domain-specific-language","dsl","java","language-server","language-server-client","language-server-protocol","lsp","typescript","visual-studio-code","xtext"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NaoMod.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-17T16:37:51.000Z","updated_at":"2024-03-16T20:32:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"2da21780-bbb9-4e96-ad4e-56c8e2552f28","html_url":"https://github.com/NaoMod/XText-Language-Server-in-VSCode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaoMod%2FXText-Language-Server-in-VSCode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaoMod%2FXText-Language-Server-in-VSCode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaoMod%2FXText-Language-Server-in-VSCode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaoMod%2FXText-Language-Server-in-VSCode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NaoMod","download_url":"https://codeload.github.com/NaoMod/XText-Language-Server-in-VSCode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243079070,"owners_count":20232924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["domain-specific-language","dsl","java","language-server","language-server-client","language-server-protocol","lsp","typescript","visual-studio-code","xtext"],"created_at":"2024-07-29T19:22:32.628Z","updated_at":"2025-03-11T17:30:39.927Z","avatar_url":"https://github.com/NaoMod.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":":imagesdir: images/\n\n= XText DSL Language Server in VSCode\n\nThis project contains an https://www.eclipse.org/Xtext[XText] project describing a very simple DSL to represent families. A language server can automatically be produced from this XText project and archived into a fat jar. This jar is then used in a https://code.visualstudio.com[Visual Studio Code] extension. By convention, the file containing programs written in this DSL have the '.fml' extension and will be referred to as FML files.\n\nThe requirements to run the extension are :\n\n * JDK between [9, 17[\n * VSCode 1.49.0 or superior\n\nThe build sections provided in the following documentation are optional, as output files are also included in this repository. However, you can still re-build the server and client modules, especially if you want to experiment and make changes to the original code. The following tools are required :\n\n * https://maven.apache.org/[Maven]\n * https://nodejs.org/en/[Node.js]\n\n== Server Implementation with XText\n\n=== Architecture\n\nThe folder _server/naomod.family.parent_ is the root folder for the XText project. It contains 3 modules :\n* _naomod.family_ : Contains the defintion of our DSL. The grammar is defined in _src/naomod/family/Family.xtext_ while the static semantics are implemented in _src_maomod/family/validation/FamilyValidator.java_.\n\nimage:family_xtext.png[Family DSL definition]\n\n* _naomod.family.ide_ : contains information about the IDE generated for our DSL. Nothing was manually changes in this module.\n* _naomod.family.tests_ : Contains tests for the other modules. There is currently a parsing test for a simple example of an FML file.\n\n=== Build\n\nRun : `make buildServer`\n\nThis command compiles the XText project, then generates a fatjar in _server/naomod.family.parent/naomod.family.ide/target/_ and copies it into _client/src/_.\n\n== VSCode Extension\n\n=== Architecture\n\nThe file _client/syntaxes/family.tmLanguage.json_ describes the syntax highlighting rules for the Family DSL. Since version 3.16.0 of LSP, it is possible to integrate this functionality in the language server, thanks to 'Semantic Tokens'. However, XText seems to either not support it (despite what's reported on their documentation) or to require specific configuration.\n\nThe file _client/src/naomod.family.ide-1.0.0-SNAPSHOT-ls.jar_ is the fatjar of the server generated during the server build.\n\nThe file _client/src/extension.ts_ specifies the behavior for the activation and deactivation of our extension. During the activation, the language server is launched from the fatjar. It is automatically stopped during the deactivation.\n\n=== Build\n\nRun : `make buildClient` to fetch all the dependencies needed to run the client.\n\n=== Running the Extension\n\nOpen this project inside VSCode. Using the Run and Debug tab, start the 'Lauch Client' configuration.\n\nimage:run_and_debug.png[Launch Client configuration]\n\nThis will start a new VSCode instance with our extension activated. To test it, you can open the file _examples/sample.fml_. You can see the content of the file benefits from syntactic coloration as well as static analysis thanks to the language server.\n\nimage:sample_fml.png[Sample FML using our language server]\n\nYou can play around using the syntax showed in the example, either by creating a new file or editing the existing one.\n\n== Build Shortcuts\n\n`make clean` to clean the build files for both client and server.\n\n`make build` to build both client and server.\n\n== References\n\n* https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/\n* https://www.eclipse.org/Xtext/documentation/340_lsp_support.html\n* https://medium.com/ballerina-techblog/implementing-a-language-server-how-hard-can-it-be-part-1-introduction-c915d2437076\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNaoMod%2FXText-Language-Server-in-VSCode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNaoMod%2FXText-Language-Server-in-VSCode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNaoMod%2FXText-Language-Server-in-VSCode/lists"}