-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tried many variations of the vanilla vscode language setup, till I go…
…t the basic tests working...
- Loading branch information
1 parent
0fcb886
commit 987fbcd
Showing
247 changed files
with
1,925 additions
and
2,662 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -131,4 +131,5 @@ dist | |
|
||
archives | ||
.temple | ||
.DS_Store | ||
.DS_Store | ||
.build |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,12 @@ | ||
{ | ||
"name": "temple-language-client", | ||
"description": "Adds syntax highlighting, formatting, auto-completion, jump-to-definition and linting for a custom.", | ||
"version": "0.0.13", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "tsc" | ||
}, | ||
"dependencies": { | ||
"vscode-languageclient": "9.0.1" | ||
} | ||
} |
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,28 @@ | ||
import type { ExtensionContext } from './language/LanguageClient'; | ||
|
||
import path from 'path'; | ||
import LanguageClient, { useBasic } from './language/LanguageClient'; | ||
|
||
let client: LanguageClient; | ||
|
||
export function activate(context: ExtensionContext) { | ||
// The server is implemented in node | ||
const server = context.asAbsolutePath(path.join('server', 'out', 'index.js')); | ||
|
||
client = useBasic({ | ||
id: 'languageServerExample', | ||
label: 'Language Server Example', | ||
language: 'plaintext', | ||
server: server | ||
}); | ||
|
||
// Start the client. This will also launch the server | ||
client.activate(); | ||
} | ||
|
||
export function deactivate() { | ||
if (!client) { | ||
return undefined; | ||
} | ||
return client.deactivate(); | ||
} |
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,95 @@ | ||
export type { ExtensionContext } from 'vscode'; | ||
export type ClientOptions = { | ||
id: string, | ||
label: string, | ||
server: string, | ||
language: string, | ||
scheme?: string, | ||
watcher?: string | ||
}; | ||
|
||
import { workspace } from 'vscode'; | ||
import { | ||
LanguageClient as VSLanguageClient, | ||
LanguageClientOptions, | ||
ServerOptions, | ||
TransportKind | ||
} from 'vscode-languageclient/node'; | ||
|
||
export default class LanguageClient { | ||
// The vscode language client | ||
protected _client: VSLanguageClient; | ||
|
||
/** | ||
* Makes a new vscode language client | ||
*/ | ||
constructor( | ||
id: string, | ||
label: string, | ||
serverOptions: ServerOptions, | ||
clientOptions: LanguageClientOptions | ||
) { | ||
// Create the language client and start the client. | ||
this._client = new VSLanguageClient( | ||
id, | ||
label, | ||
serverOptions, | ||
clientOptions | ||
); | ||
} | ||
|
||
/** | ||
* Starts the client | ||
*/ | ||
activate() { | ||
// Start the client. This will also launch the server | ||
return this._client.start(); | ||
} | ||
|
||
/** | ||
* Stops the client | ||
*/ | ||
deactivate(): Thenable<void> | undefined { | ||
return this._client.stop(); | ||
} | ||
} | ||
|
||
export function useBasic(options: ClientOptions) { | ||
const { | ||
id, | ||
label, | ||
server, | ||
language, | ||
scheme = 'file', | ||
watcher = '**/.clientrc' | ||
} = options; | ||
|
||
// If the extension is launched in debug mode | ||
// then the debug server options are used | ||
// Otherwise the run options are used | ||
const serverOptions: ServerOptions = { | ||
run: { module: server, transport: TransportKind.ipc }, | ||
debug: { | ||
module: server, | ||
transport: TransportKind.ipc, | ||
} | ||
}; | ||
|
||
// Options to control the language client | ||
const clientOptions: LanguageClientOptions = { | ||
// Register the server for plain text documents | ||
documentSelector: [{ scheme, language }], | ||
synchronize: { | ||
// Notify the server about file changes to | ||
// '.clientrc files contained in the workspace | ||
fileEvents: workspace.createFileSystemWatcher(watcher) | ||
} | ||
}; | ||
|
||
return new LanguageClient( | ||
id, | ||
label, | ||
serverOptions, | ||
clientOptions | ||
); | ||
} |
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,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"esModuleInterop": true, | ||
"module": "commonjs", | ||
"target": "es2020", | ||
"lib": ["es2020"], | ||
"outDir": "out", | ||
"rootDir": "src", | ||
"sourceMap": true, | ||
"types": [] | ||
}, | ||
"include": ["src"], | ||
"exclude": ["node_modules"] | ||
} |
Oops, something went wrong.