From 0d2692bd2662590291811999726bdb1055e28f64 Mon Sep 17 00:00:00 2001 From: Yatao Li Date: Sun, 30 Jun 2019 15:41:12 +0800 Subject: [PATCH] configuration section reading ok. supporting powershell exe config --- package-lock.json | 2 +- src/client/extension.ts | 13 ++++++++----- src/client/settings.ts | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 10f2585..ee2bb56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "coc-powershell", - "version": "0.0.1", + "version": "0.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/client/extension.ts b/src/client/extension.ts index 5bf1eda..1f254cc 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -10,18 +10,21 @@ import * as path from 'path'; import { workspace, ExtensionContext } from 'coc.nvim'; import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'coc.nvim'; import { getDefaultPowerShellPath, getPlatformDetails } from './platform'; +import * as settings from './settings'; import Shell from "node-powershell"; // Important paths. +const config = settings.load() const cocPowerShellRoot = path.join(__dirname, "..", ".."); const bundledModulesPath = path.join(cocPowerShellRoot, "PowerShellEditorServices"); const logPath = path.join(cocPowerShellRoot, `/.pses/logs/${crypto.randomBytes(16).toString("hex")}-${process.pid}`); - -// TODO log redirection? -const logger = workspace.createOutputChannel("coc-powershell"); +const logger = workspace.createOutputChannel('powershell') export async function activate(context: ExtensionContext) { - const pwshPath = getDefaultPowerShellPath(getPlatformDetails()) + + let pwshPath = config.powerShellExePath + ? config.powerShellExePath + : getDefaultPowerShellPath(getPlatformDetails()) logger.appendLine("starting.") logger.appendLine(`pwshPath = ${pwshPath}`) logger.appendLine(`bundledModulesPath = ${bundledModulesPath}`) @@ -72,7 +75,7 @@ export async function activate(context: ExtensionContext) { documentSelector: [{ scheme: 'file', language: 'ps1' }], synchronize: { // Synchronize the setting section 'powershell' to the server - configurationSection: 'ps1', + configurationSection: 'powershell', // Notify the server about file changes to PowerShell files contain in the workspace fileEvents: [ workspace.createFileSystemWatcher('**/*.ps1'), diff --git a/src/client/settings.ts b/src/client/settings.ts index 4208a93..6caf32b 100644 --- a/src/client/settings.ts +++ b/src/client/settings.ts @@ -104,7 +104,7 @@ export function load(): ISettings { utils.PowerShellLanguageId); const defaultBugReportingSettings: IBugReportingSettings = { - project: "https://github.com/PowerShell/vscode-powershell", + project: "https://github.com/yatli/coc-powershell", }; const defaultScriptAnalysisSettings: IScriptAnalysisSettings = {