Skip to content

Instantly share code, notes, and snippets.

@bamboo
Last active April 26, 2021 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bamboo/6828d90cc059b491c963ca1d6d8dbc78 to your computer and use it in GitHub Desktop.
Save bamboo/6828d90cc059b491c963ca1d6d8dbc78 to your computer and use it in GitHub Desktop.
hacky vscode instructions for idris2-lsp

VSCode

Hacky way to get VSCode to activate idris2-lsp.

  1. Clone https://github.com/microsoft/vscode-extension-samples

  2. cd vscode-extensions-samples/lsp-sample and follow the README

  3. Apply the following diff adapting serverModule to your environment

--- a/lsp-sample/client/src/extension.ts
+++ b/lsp-sample/client/src/extension.ts
@@ -16,29 +16,19 @@ import {
 let client: LanguageClient;

 export function activate(context: ExtensionContext) {
-       // The server is implemented in node
-       let serverModule = context.asAbsolutePath(
-               path.join('server', 'out', 'server.js')
-       );
-       // The debug options for the server
-       // --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
-       let debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] };
+       let serverModule = "/path/to/idris2-lsp/build/exec/idris2-lsp";

        // If the extension is launched in debug mode then the debug server options are used
        // Otherwise the run options are used
        let serverOptions: ServerOptions = {
-               run: { module: serverModule, transport: TransportKind.ipc },
-               debug: {
-                       module: serverModule,
-                       transport: TransportKind.ipc,
-                       options: debugOptions
-               }
+               run: { command: serverModule, },
+               debug: { command: serverModule, }
        };

        // Options to control the language client
        let clientOptions: LanguageClientOptions = {
                // Register the server for plain text documents
-               documentSelector: [{ scheme: 'file', language: 'plaintext' }],
+               documentSelector: [{ scheme: 'file', language: 'idris' }],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment