Skip to content

Commit

Permalink
configuration section reading ok. supporting powershell exe config
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatao Li committed Jun 30, 2019
1 parent 9b76b0f commit 0d2692b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions src/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand Down Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion src/client/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 0d2692b

Please sign in to comment.