cucumber / language-server

Cucumber Language Server
MIT License
35 stars 20 forks source link

Fix autocomplete - load expressions from step definitions #19

Closed aslakhellesoy closed 2 years ago

aslakhellesoy commented 2 years ago

Is your feature request related to a problem? Please describe.

The language server currently reports 0 items for autocompletion. This is because it doesn't load any step definitions (cucumber expressions and regular expressions).

Describe the solution you'd like The ExpressionBuilder object that we pass to the CucumberLanguageServer constructor is currently not used. We should call ExpressionBuilder#build on it, passing in the source code of all the Java/TypeScript files in the project. To improve performance, we should only load the source code that contains step definitions, and not production source code. This could use a glob that is defined as part of settings.

The LSP does not yet provide a way to read the file system, so this has to be done using the Node.js fs module. It might need to use some kind of "watch" trigger so that we read again whenever a step definitions file is modified/added/deleted.

Using fs has consequences for https://github.com/cucumber/vscode/issues/1 - we cannot use fs in a web extension.

aslakhellesoy commented 2 years ago

This is fixed on main