Skip to content

Latest commit

 

History

History
93 lines (59 loc) · 3.42 KB

README.md

File metadata and controls

93 lines (59 loc) · 3.42 KB

textX vs code

NOTE: This project is deprecated. It is superseded by textX-LS.

This is a VS code extension which uses textX-languageserver. It implements Language Server Protocol.

Extension can be found on marketplace.

textX-ls extension in action

textX language server

Configuration

Manually adding path to python 3

If you are getting message "Python 3 is required!", you should try to manually add a path to python 3.

Go to File -> Preferences -> Settings (shortcut: CTRL + Comma) and in User or Workspace settings tab add a new key-value pair "textxls.pythonPath": "PATH_TO_PYTHON3"

.txconfig file example

dsl Workflow [wf] {

	general {
		publisher: "test"
		version: "0.0.1"
	}

	paths {
		grammar: "workflow/workflow.tx"
		outline: "workflow/workflow.txol"
		coloring: "workflow/workflow.txcl"
	}
}

Commands

Press F1 and start typing one of following commands:

  • Export metamodel to dot (creates dot file for your grammar in projects root; textx command)
  • Export model to dot (creates dot file for your model(s) in projects root; textx command)
  • Generate vscode extension (generates vs code extension for language defined with .txconfig)

Packaging and installing generated extension

If everything works fine, after invoking Generate vscode extension command, you should see new gen directory in your projects root.

  1. Make sure you have vsce installed on your machine (npm install -g vsce)
  2. cd gen
  3. vsce package - This will generate new .vsix file in gen directory
  4. Install extension

NOTE:

Generated vs code extensions have their own language server which are activated just on language specified in .txconfig file.

If you have both textx-ls and your generated extension installed, you should disable textx-ls extension or remove .txconfig file from workspace.

Activation events, languages, commands, snippets

Please take a look at package.json

Building and running locally

  1. Install dependencies npm install
  2. In extension.ts comment startLangServer and uncomment startLangServerTCP
// START FOR PUBLISH
lsDisp = startLangServer(python, [textxls_main], []);

// START CLIENT TCP
// lsDisp = startLangServerTCP(5000);
context.subscriptions.push(lsDisp);
  1. Be sure you run language server in tcp mode. Steps to run language server
  2. Press F5
  3. Open [examples] directory (https://github.com/textX/textX-languageserver/tree/master/examples)

Language server should start if you have valid .txconfig file in projects root.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Fixed vscode-language-server-node bug