Skip to content

Commit

Permalink
delete all .vim and run install script
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerLeonhardt committed Jun 26, 2019
1 parent fe396cb commit c84a91e
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 230 deletions.
40 changes: 0 additions & 40 deletions autoload/coc/powershell.vim

This file was deleted.

88 changes: 0 additions & 88 deletions autoload/coc/powershell/utils.vim

This file was deleted.

97 changes: 54 additions & 43 deletions client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,76 @@
* ------------------------------------------------------------------------------------------ */
'use strict';

import * as fs from 'fs';
import * as path from 'path';
import { workspace, ExtensionContext, commands } from 'coc.nvim';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'coc.nvim';
import { Range } from 'vscode-languageserver-types';
import { getDefaultPowerShellPath, getPlatformDetails } from './platform';
import Shell from "node-powershell";

const cocPowerShellRoot = path.join(__dirname, "..", "..");
const bundledModulesPath = path.join(cocPowerShellRoot, "PowerShellEditorServices");
const logPath = path.join(cocPowerShellRoot, "/.pses/logs/1234");

export function activate(context: ExtensionContext) {
setTimeout(function () {
const pwshPath = getDefaultPowerShellPath(getPlatformDetails())
export async function activate(context: ExtensionContext) {
const pwshPath = getDefaultPowerShellPath(getPlatformDetails())

// If PowerShellEditorServices is not downloaded yet, run the install script to do so.
if (!fs.existsSync(bundledModulesPath)) {
const ps = new Shell({
executionPolicy: 'Bypass',
noProfile: true
});

ps.addCommand(path.join(cocPowerShellRoot, "install.ps1"));
await ps.invoke();
}

let serverOptions: ServerOptions = {
command: pwshPath,
args: [
"-NoProfile",
"-NonInteractive",
path.join(bundledModulesPath, "/PowerShellEditorServices/Start-EditorServices.ps1"),
"-HostName", "coc.vim",
"-HostProfileId", "0",
"-HostVersion", "2.0.0",
"-LogPath", path.join(logPath, "log.txt"),
"-LogLevel", "Diagnostic",
"-BundledModulesPath", bundledModulesPath,
"-Stdio",
"-SessionDetailsPath", path.join(logPath, "session")],
transport: TransportKind.stdio
}
let serverOptions: ServerOptions = {
command: pwshPath,
args: [
"-NoProfile",
"-NonInteractive",
path.join(bundledModulesPath, "/PowerShellEditorServices/Start-EditorServices.ps1"),
"-HostName", "coc.vim",
"-HostProfileId", "0",
"-HostVersion", "2.0.0",
"-LogPath", path.join(logPath, "log.txt"),
"-LogLevel", "Diagnostic",
"-BundledModulesPath", bundledModulesPath,
"-Stdio",
"-SessionDetailsPath", path.join(logPath, "session")],
transport: TransportKind.stdio
}

workspace.addRootPatterns('ps1', ['*.ps1', '*.psd1', '*.psm1', '.vim', '.git', '.hg'])
workspace.addRootPatterns('ps1', ['*.ps1', '*.psd1', '*.psm1', '.vim', '.git', '.hg'])

// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for F# documents
documentSelector: [{ scheme: 'file', language: 'ps1' }],
synchronize: {
// Synchronize the setting section 'powershell' to the server
configurationSection: 'ps1',
// Notify the server about file changes to PowerShell files contain in the workspace
// TODO: is there a way to configure this via the language server protocol?
fileEvents: [
workspace.createFileSystemWatcher('**/*.ps1'),
workspace.createFileSystemWatcher('**/*.psd1'),
workspace.createFileSystemWatcher('**/*.psm1')
]
}
// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for F# documents
documentSelector: [{ scheme: 'file', language: 'ps1' }],
synchronize: {
// Synchronize the setting section 'powershell' to the server
configurationSection: 'ps1',
// Notify the server about file changes to PowerShell files contain in the workspace
// TODO: is there a way to configure this via the language server protocol?
fileEvents: [
workspace.createFileSystemWatcher('**/*.ps1'),
workspace.createFileSystemWatcher('**/*.psd1'),
workspace.createFileSystemWatcher('**/*.psm1')
]
}
}

// Create the language client and start the client.
let client = new LanguageClient('ps1', 'PowerShell Language Server', serverOptions, clientOptions);
let disposable = client.start();
// Create the language client and start the client.
let client = new LanguageClient('ps1', 'PowerShell Language Server', serverOptions, clientOptions);
let disposable = client.start();

// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context.subscriptions.push(disposable);
commands.registerCommand('powershell.command.goto', goto);
}, 10000);
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context.subscriptions.push(disposable);
commands.registerCommand('powershell.command.goto', goto);
}

function goto(file: string, startLine: number, startColumn: number, _endLine: number, _endColumn: number) {
Expand Down
1 change: 0 additions & 1 deletion ftdetect/ps1.vim

This file was deleted.

50 changes: 0 additions & 50 deletions ftplugin/ps1.vim

This file was deleted.

5 changes: 0 additions & 5 deletions install.ps1
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,4 @@ Remove-Item $zip -Force

Write-Host PowerShell Editor Services install completed.

Write-Host Installing Node dependencies...

npm install
npm run compile

Pop-Location
Loading

0 comments on commit c84a91e

Please sign in to comment.