-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc1f1c6
commit 249b55a
Showing
13 changed files
with
4,068 additions
and
5 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import vscode from "vscode"; | ||
import { LanguageClient, LanguageClientOptions, ServerOptions } from "vscode-languageclient/node"; | ||
import os from "os" | ||
import path from "path"; | ||
import fs from "fs" | ||
|
||
export default function runLSP() { | ||
let executablePath: string = ''; | ||
const platform: string = os.platform(); | ||
const arch: string = os.arch(); | ||
|
||
if (platform === "win32") { | ||
if (arch === "x64") { | ||
executablePath = path.join(__dirname, '..', 'lsp-bin', 'windows', 'x64.exe'); | ||
} else if (os.arch() === "ia32") { | ||
executablePath = path.join(__dirname, '..', 'lsp-bin', 'windows', 'x86.exe'); | ||
} | ||
else { | ||
executablePath = path.join(__dirname, '..', 'lsp-bin', 'windows', 'arm64.exe'); | ||
} | ||
} else if (platform == "darwin") { | ||
if (arch === "x64") { | ||
executablePath = path.join(__dirname, '..', 'lsp-bin', 'macos', 'x64'); | ||
} else if (os.arch() === "ia32") { | ||
executablePath = path.join(__dirname, '..', 'lsp-bin', 'macos', 'x86'); | ||
} | ||
else { | ||
executablePath = path.join(__dirname, '..', 'lsp-bin', 'macos', 'arm64'); | ||
} | ||
} else { | ||
if (arch === "x64") { | ||
executablePath = path.join(__dirname, '..', 'lsp-bin', 'linux', 'x64'); | ||
} else if (os.arch() === "ia32") { | ||
executablePath = path.join(__dirname, '..', 'lsp-bin', 'linux', 'x86'); | ||
} | ||
else { | ||
executablePath = path.join(__dirname, '..', 'lsp-bin', 'linux', 'arm64'); | ||
} | ||
} | ||
fs.chmod(executablePath, 0o775, (err) => { | ||
if (err) throw err; | ||
console.log('The permissions for file "my_file.txt" have been changed!'); | ||
}); | ||
|
||
let serverOptions: ServerOptions = { | ||
run: { command: executablePath }, | ||
debug: { command: executablePath } | ||
}; | ||
|
||
let clientOptions: LanguageClientOptions = { | ||
documentSelector: [{ scheme: 'file', language: 'bend' }], | ||
}; | ||
|
||
// Create the language client and start the client. | ||
const client = new LanguageClient( | ||
'bendlang', | ||
'bendlangserver', | ||
serverOptions, | ||
clientOptions | ||
); | ||
|
||
// Start the client. This will also launch the server | ||
client.start(); | ||
} |