[css/html/json] Randomize inspect ports to avoid conflicts

This commit is contained in:
Martin Aeschlimann 2020-11-04 16:03:27 +01:00
parent 4cd46e32b2
commit e3a79e9e44
4 changed files with 4 additions and 27 deletions

View file

@ -1,14 +1,5 @@
{
"version": "0.2.0",
"compounds": [
{
"name": "Debug Extension and Language Server",
"configurations": [
"Launch Extension",
"Attach Language Server"
]
}
],
"configurations": [
{
"name": "Launch Extension",
@ -41,19 +32,6 @@
]
},
{
"name": "Attach Language Server",
"type": "node",
"request": "attach",
"protocol": "inspector",
"port": 6044,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/server/out/**/*.js"
],
"smartStep": true,
"restart": true
},
{
"name": "Server Unit Tests",
"type": "node",
"request": "launch",
@ -74,4 +52,4 @@
]
}
]
}
}

View file

@ -11,14 +11,13 @@ import { TextDecoder } from 'util';
// this method is called when vs code is activated
export function activate(context: ExtensionContext) {
const clientMain = extensions.getExtension('vscode.css-language-features')?.packageJSON?.main || '';
const serverMain = `./server/${clientMain.indexOf('/dist/') !== -1 ? 'dist' : 'out'}/node/cssServerMain`;
const serverModule = context.asAbsolutePath(serverMain);
// The debug options for the server
const debugOptions = { execArgv: ['--nolazy', '--inspect=6044'] };
const debugOptions = { execArgv: ['--nolazy', '--inspect=' + (7000 + Math.round(Math.random() * 999))] };
// If the extension is launch in debug mode the debug server options are use
// Otherwise the run options are used

View file

@ -24,7 +24,7 @@ export function activate(context: ExtensionContext) {
const serverModule = context.asAbsolutePath(serverMain);
// The debug options for the server
const debugOptions = { execArgv: ['--nolazy', '--inspect=6044'] };
const debugOptions = { execArgv: ['--nolazy', '--inspect=' + (8000 + Math.round(Math.random() * 999))] };
// If the extension is launch in debug mode the debug server options are use
// Otherwise the run options are used

View file

@ -25,7 +25,7 @@ export function activate(context: ExtensionContext) {
const serverModule = context.asAbsolutePath(serverMain);
// The debug options for the server
const debugOptions = { execArgv: ['--nolazy', '--inspect=6044'] };
const debugOptions = { execArgv: ['--nolazy', '--inspect=' + (6000 + Math.round(Math.random() * 999))] };
// If the extension is launch in debug mode the debug server options are use
// Otherwise the run options are used