cucumber / language-server

Cucumber Language Server
MIT License
33 stars 19 forks source link

In process #65

Closed aslakhellesoy closed 1 year ago

aslakhellesoy commented 1 year ago

🤔 What's changed?

Expose a newWasmServer function that returns two streams for LSP.

⚡️ What's your motivation?

To be able to start the server in-process in the VSCode extension. This allows us to control more of the server behaviour:

First, it lays a foundation for https://github.com/cucumber/vscode/pull/81 and https://github.com/cucumber/blockly/issues/23 because it makes it possible to start a 2nd language server for the Blockly editor, which will use an LSP client to retrieve all the steps.

However, as I am writing this, I realize that the Blockly editor isn't going to get the suggestions via auto-complete, because that only returns matching results for a string. It's going to need them all. It might be better to do something similar to GherkinLanguageServer.reindex. Ot better, access the already indexed data from the server instance:

const server = new CucumberLanguageServer(...)
// later...
const suggestions = server.suggestions

In any case, this refactoring will make this possible.

Another benefit of this refactoring is preparing for https://github.com/cucumber/vscode/issues/1 We could abstract file system access behind a simple FileSystem API and pass in one that is backed by either https://code.visualstudio.com/api/references/vscode-api#FileSystem (which we would use in VSCode), or a Node.js file system implementation (for standalone mode - vim etc).

This API would have operations for globbing. For VSCode we can use vscode.workspace.findFiles.

Solving this might be a milestone towards making the VSCode extension ready for GitHub Codespaces / github.dev

🏷️ What kind of change is this?

♻️ Anything particular you want feedback on?

📋 Checklist:


This text was originally generated from a template, then edited by hand. You can modify the template here.