-
Notifications
You must be signed in to change notification settings - Fork 338
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
Showing
9 changed files
with
620 additions
and
0 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
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,18 @@ | ||
{ | ||
"name": "testbed-client", | ||
"description": "Testbed client", | ||
"version": "0.1.0", | ||
"private": true, | ||
"publisher": "vscode", | ||
"engines": { | ||
"vscode": "^1.40.0" | ||
}, | ||
"scripts": { | ||
"watch": "tsc -watch -b ./tsconfig.json", | ||
"compile": "tsc -b ./tsconfig.json" | ||
}, | ||
"dependencies": { | ||
}, | ||
"devDependencies": { | ||
} | ||
} |
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,70 @@ | ||
/* -------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
* ------------------------------------------------------------------------------------------ */ | ||
'use strict'; | ||
|
||
import * as path from 'path'; | ||
import { commands, ExtensionContext, Uri } from 'vscode'; | ||
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from '../../../client/lib/main'; | ||
|
||
let client: LanguageClient; | ||
|
||
export function activate(context: ExtensionContext) { | ||
// We need to go one level up since an extension compile the js code into | ||
// the output folder. | ||
let module = path.join(__dirname, '..', '..', 'server', 'out', 'server.js'); | ||
let debugOptions = { execArgv: ["--nolazy", "--inspect=6012"] }; | ||
let serverOptions: ServerOptions = { | ||
run: { module, transport: TransportKind.ipc }, | ||
debug: { module, /* runtime: 'node.exe', */ transport: TransportKind.ipc, options: debugOptions} | ||
}; | ||
|
||
let clientOptions: LanguageClientOptions = { | ||
documentSelector: [ | ||
'bat', | ||
{ pattern: '**/.vscode/test.txt', scheme: 'file' } | ||
], | ||
synchronize: { | ||
configurationSection: 'testbed' | ||
// fileEvents: workspace.createFileSystemWatcher('**/*'), | ||
}, | ||
diagnosticCollectionName: 'markers', | ||
initializationOptions: 'Chris it gets passed to the server', | ||
progressOnInitialization: true, | ||
stdioEncoding: 'utf8', | ||
uriConverters: { | ||
code2Protocol: (value: Uri) => { | ||
return `vscode-${value.toString()}` | ||
}, | ||
protocol2Code: (value: string) => { | ||
return Uri.parse(value.substring(7)) | ||
} | ||
}, | ||
middleware: { | ||
didOpen: (document, next) => { | ||
next(document); | ||
} | ||
} | ||
} | ||
|
||
client = new LanguageClient('testbed', 'Testbed', serverOptions, clientOptions); | ||
client.registerProposedFeatures(); | ||
// let not: NotificationType<string[], void> = new NotificationType<string[], void>('testbed/notification'); | ||
client.onReady().then(() => { | ||
client.sendNotification('testbed/notification', ['dirk', 'baeumer']); | ||
}); | ||
client.onTelemetry((data: any) => { | ||
console.log(`Telemetry event received: ${JSON.stringify(data)}`); | ||
}); | ||
client.start(); | ||
commands.registerCommand('testbed.myCommand.invoked', () => { | ||
commands.executeCommand('testbed.myCommand').then(value => { | ||
console.log(value); | ||
}); | ||
}); | ||
} | ||
|
||
export function deactivate() { | ||
return client.stop(); | ||
} |
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": { | ||
"module": "commonjs", | ||
"target": "es2017", | ||
"outDir": "out", | ||
"rootDir": "src", | ||
"lib": ["es2017"], | ||
"sourceMap": true, | ||
"incremental": true, | ||
"tsBuildInfoFile":"./out/tsconfig.tsbuildInfo", | ||
}, | ||
"include": ["src"], | ||
"exclude": ["node_modules", ".vscode-test"] | ||
} |
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,43 @@ | ||
{ | ||
"name": "testbed", | ||
"description": "testbed", | ||
"version": "0.1.0", | ||
"publisher": "vscode", | ||
"engines": { | ||
"vscode": "^1.33.0" | ||
}, | ||
"main": "./client/out/extension", | ||
"activationEvents": [ | ||
"onLanguage:bat" | ||
], | ||
"enableProposedApi": true, | ||
"contributes": { | ||
"commands": [ | ||
{ | ||
"command": "testbed.helloWorld", | ||
"title": "Hello World" | ||
} | ||
], | ||
"configuration": { | ||
"type": "object", | ||
"title": "TestBed configuration", | ||
"properties": { | ||
"testbed.enable": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Control whether eslint is enabled for JavaScript files or not." | ||
}, | ||
"testbed.options": { | ||
"type": "object", | ||
"default": {}, | ||
"description": "The eslint options object to provide args to the eslint command." | ||
} | ||
} | ||
} | ||
}, | ||
"scripts": { | ||
"compile": "tsc -b", | ||
"clean": "tsc -b --clean", | ||
"watch": "tsc -b -w" | ||
} | ||
} |
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,13 @@ | ||
{ | ||
"name": "testbed-server", | ||
"version": "0.1.0", | ||
"description": "TestBed Server", | ||
"private": true, | ||
"engines": { | ||
"node": "*" | ||
}, | ||
"scripts": { | ||
"compile": "tsc -b ./tsconfig.json", | ||
"watch": "tsc --watch -b ./tsconfig.json" | ||
} | ||
} |
Oops, something went wrong.