add `inspectPort` setting

master
Brad Cornes 2021-06-04 14:00:00 +01:00
parent 73886ffbf0
commit e3942e89e4
2 changed files with 22 additions and 5 deletions

View File

@ -180,6 +180,14 @@
"type": "number", "type": "number",
"default": 16, "default": 16,
"markdownDescription": "Root font size in pixels. Used to convert `rem` CSS values to their `px` equivalents. See `#tailwindCSS.showPixelEquivalents#`." "markdownDescription": "Root font size in pixels. Used to convert `rem` CSS values to their `px` equivalents. See `#tailwindCSS.showPixelEquivalents#`."
},
"tailwindCSS.inspectPort": {
"type": [
"number",
"null"
],
"default": null,
"markdownDescription": "Enable the Node.js inspector agent for the language server and listen on the specified port."
} }
} }
} }

View File

@ -179,8 +179,19 @@ export async function activate(context: ExtensionContext) {
commands.executeCommand('setContext', 'tailwindCSS.hasOutputChannel', true) commands.executeCommand('setContext', 'tailwindCSS.hasOutputChannel', true)
} }
let configuration = {
editor: Workspace.getConfiguration('editor', folder),
tailwindCSS: Workspace.getConfiguration('tailwindCSS', folder),
}
let inspectPort = configuration.tailwindCSS.get('inspectPort')
let serverOptions: ServerOptions = { let serverOptions: ServerOptions = {
run: { module, transport: TransportKind.ipc }, run: {
module,
transport: TransportKind.ipc,
options: { execArgv: inspectPort === null ? [] : [`--inspect=${inspectPort}`] },
},
debug: { debug: {
module, module,
transport: TransportKind.ipc, transport: TransportKind.ipc,
@ -189,6 +200,7 @@ export async function activate(context: ExtensionContext) {
}, },
}, },
} }
let clientOptions: LanguageClientOptions = { let clientOptions: LanguageClientOptions = {
documentSelector: languages.get(folder.uri.toString()).map((language) => ({ documentSelector: languages.get(folder.uri.toString()).map((language) => ({
scheme: 'file', scheme: 'file',
@ -314,10 +326,7 @@ export async function activate(context: ExtensionContext) {
}, },
initializationOptions: { initializationOptions: {
userLanguages: getUserLanguages(folder), userLanguages: getUserLanguages(folder),
configuration: { configuration,
editor: Workspace.getConfiguration('editor', folder),
tailwindCSS: Workspace.getConfiguration('tailwindCSS', folder),
},
}, },
synchronize: { synchronize: {
configurationSection: ['editor', 'tailwindCSS'], configurationSection: ['editor', 'tailwindCSS'],