Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extension: first cut of lsp-aware extension
This gives the vscode-cue extension the basic capabilities to start an instance of 'cue lsp'. The code is heavily commented to: * caveat my poor handle on TypeScript; * explain the code structure of the extension; * capture my understanding and assumptions about the behaviour of VSCode and an extension instance in relation to a running LSP server; * state opinions/assumptions about error handling style in code. * state understanding about the best method of handling runtime errors, and how/when to report those to the user. The bulk of the changes sit within src/main.ts: * The extension creates a LanguageClient instance which is the bridge between a running 'cue lsp' instance (which it, the LanguageClient starts) and a VSCode window. * We use output channels for more clear logging of info and errors. * We establish a clearer policy on when to notify the end user of errors via showErrorMessage. * We handle runtime configuration changes of an extension instance. There are various other helper functions, types etc in support of these changes. At an extension configuration level this change: * Exposes two additional commands: start CUE LSP, stop CUE LSP; * aligns the engine version required by the extension with the npm dependency on the VSCode types; * sets an explicit activation event of 'onLanguage:cue', so an instance of the extension is created whenever a CUE file is opened. Note the comment 'Extension instances and configuration' on caveats in this space; * exposes the extension's configuration schema as a JSON Schema. A TODO captures moving this to CUE when we can (noting that we also need to code generate TypeScript ultimately, as well as runtime unifying a configuration value with some documented defaults). We also add various npm dependencies required by the code changes described above. Note that this change does not include any tests. This is intentional however undesirable. Adding end-to-end tests will follow later. For now, testing is limited to offline running through various scenarios using VSCode. The scenarios covered are documented in testing.md. Signed-off-by: Paul Jolly <[email protected]> Change-Id: I6a1879a603ff2db693f045d26fe14018c01c6332 Dispatch-Trailer: {"type":"trybot","CL":1201041,"patchset":91,"ref":"refs/changes/41/1201041/91","targetBranch":"master"}
- Loading branch information