Skip to content

Commit d9e7f6a

Browse files
committed
feat: Start automatically
1 parent c2c14c7 commit d9e7f6a

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,19 @@
2424
"categories": [
2525
"Programming Languages"
2626
],
27-
"activationEvents": [],
27+
"activationEvents": [
28+
"onLanguage:shaderlab"
29+
],
2830
"main": "./out/extension.js",
2931
"contributes": {
3032
"commands": [
3133
{
3234
"command": "vscode-shader.start",
33-
"title": "Start shader-ls"
35+
"title": "Start `shader langauge server`"
36+
},
37+
{
38+
"command": "vscode-shader.stop",
39+
"title": "Stop `shader langauge server`"
3440
}
3541
],
3642
"configuration": {

src/extension.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ export function activate(context: vscode.ExtensionContext) {
4343

4444
// Register the commands
4545
context.subscriptions.push(vscode.commands.registerCommand('vscode-shader.start', start));
46+
context.subscriptions.push(vscode.commands.registerCommand('vscode-shader.stop', stop));
4647

4748
// Start the client. This will also launch the server
4849
{
49-
console.log('[INFO] `shader-language-server` is running!');
5050
client.setTrace(Trace.Verbose);
51-
client.start();
51+
start();
5252
}
5353
}
5454

@@ -61,5 +61,12 @@ export function deactivate() {
6161
}
6262

6363
async function start() {
64-
//console.log('test start command!!!!!!!!!!~~');
64+
client.start();
65+
console.log('[INFO] `shader-language-server` is running!');
66+
}
67+
68+
69+
async function stop() {
70+
deactivate();
71+
console.log('[INFO] `shader-language-server` has been shutdown!');
6572
}

0 commit comments

Comments
 (0)