From 7a74b20340229f449fbe403d8a446a7524d9281c Mon Sep 17 00:00:00 2001 From: wdhg Date: Mon, 20 Sep 2021 00:35:53 +0100 Subject: [PATCH 1/9] Remove prepare script, update packages --- package.json | 11 +++++------ src/client/extension.ts | 7 ++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 379a31b..4846c39 100644 --- a/package.json +++ b/package.json @@ -119,18 +119,17 @@ ] }, "scripts": { - "prepare": "npx npm-run-all compile", "compile": "tsc -p ./", "watch": "tsc -watch -p ./" }, "extensionDependencies": [], "dependencies": { - "@types/follow-redirects": "^1.8.0", - "coc-utils": "0.0.12" + "@types/follow-redirects": "^1.13.1", + "coc-utils": "0.0.16" }, "devDependencies": { - "@types/node": "^10.3.3", - "typescript": "^3.5.2", - "coc.nvim": "^0.0.73" + "@types/node": "^16.9.4", + "typescript": "^4.4.3", + "coc.nvim": "^0.0.80" } } diff --git a/src/client/extension.ts b/src/client/extension.ts index ea253a5..341bbfc 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -11,6 +11,7 @@ import { ExtensionContext, commands, workspace, + window, LanguageClient, LanguageClientOptions } from 'coc.nvim'; @@ -21,8 +22,8 @@ import { sleep } from 'coc-utils' -const logger = workspace.createOutputChannel("coc-omnisharp") -const omnisharpLogger = workspace.createOutputChannel("omnisharp") +const logger = window.createOutputChannel("coc-omnisharp") +const omnisharpLogger = window.createOutputChannel("omnisharp") const omnisharpVersion = workspace.getConfiguration('omnisharp').get('version').toLowerCase(); const omnisharpRepo: LanguageServerRepository = { kind: "github", @@ -109,7 +110,7 @@ export async function activate(context: ExtensionContext) { } await omnisharpProvider.downloadLanguageServer() if (useCustomPath) { - workspace.showMessage(`coc-omnisharp: Using custom executable (${omnisharpCustomPath}) so the downloaded bundle will have no effect`, 'warning') + window.showMessage(`coc-omnisharp: Using custom executable (${omnisharpCustomPath}) so the downloaded bundle will have no effect`, 'warning') } client_dispose = client.start() context.subscriptions.push(client_dispose) From 1a618bfd4cc857e0145a49f28cc4d735d5aba293 Mon Sep 17 00:00:00 2001 From: wdhg Date: Mon, 20 Sep 2021 00:40:14 +0100 Subject: [PATCH 2/9] Turn off noImplicitAny --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 58cf853..02c07fb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "noUnusedLocals": false, "noUnusedParameters": false, - "noImplicitAny": true, + "noImplicitAny": false, "noImplicitReturns": true, "target": "es6", "module": "commonjs", From 600574eee81c566cb36af19babfe8aea1323fb2b Mon Sep 17 00:00:00 2001 From: wdhg Date: Mon, 20 Sep 2021 20:19:09 +0100 Subject: [PATCH 3/9] Add osx-arm64 --- src/client/extension.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client/extension.ts b/src/client/extension.ts index 341bbfc..1ad458a 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -35,6 +35,7 @@ const omnisharpPacks: ILanguageServerPackages = { "win-x64": { platformPath: "omnisharp-win-x64.zip", executable: "Omnisharp.exe" }, "linux-x64": { platformPath: "omnisharp-linux-x64.zip", executable: "run" }, "osx-x64": { platformPath: "omnisharp-osx.zip", executable: "run" }, + "osx-arm64": { platformPath: "omnisharp-mono.zip", executable: "mono --assembly-loader=strict Omnisharp.exe" }, } export async function activate(context: ExtensionContext) { From 383370fee315cafbcc643ea40cf5111222b69381 Mon Sep 17 00:00:00 2001 From: wdhg Date: Mon, 20 Sep 2021 20:32:19 +0100 Subject: [PATCH 4/9] Set serverOptions differently on arm64 --- src/client/extension.ts | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/client/extension.ts b/src/client/extension.ts index 1ad458a..f37ee9a 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -31,11 +31,12 @@ const omnisharpRepo: LanguageServerRepository = { channel: omnisharpVersion === "latest" ? omnisharpVersion : `tags/${omnisharpVersion}` } + const omnisharpPacks: ILanguageServerPackages = { "win-x64": { platformPath: "omnisharp-win-x64.zip", executable: "Omnisharp.exe" }, "linux-x64": { platformPath: "omnisharp-linux-x64.zip", executable: "run" }, "osx-x64": { platformPath: "omnisharp-osx.zip", executable: "run" }, - "osx-arm64": { platformPath: "omnisharp-mono.zip", executable: "mono --assembly-loader=strict Omnisharp.exe" }, + "osx-arm64": { platformPath: "omnisharp-mono.zip", executable: "Omnisharp.exe" }, } export async function activate(context: ExtensionContext) { @@ -89,12 +90,28 @@ export async function activate(context: ExtensionContext) { logger.appendLine("omnisharp debug mode activated") } - let serverOptions = { - command: omnisharpExe, - args: args, - options: {cwd: workspace.rootPath} + + let serverOptions; + + if (process.arch === "arm64") { + // desired command: mono --assembly-loader=strict Omnisharp.exe + args.unshift('--assembly-loader=strict') + args.unshift('mono') + + serverOptions = { + command: "mono", + args: args, + options: {cwd: workspace.rootPath} + } + } else { + serverOptions = { + command: omnisharpExe, + args: args, + options: {cwd: workspace.rootPath} + } } + // Create the language client and start the client. let client = new LanguageClient('cs', 'OmniSharp Language Server', serverOptions, clientOptions); let client_dispose = client.start(); From 0e9751379e464f5422cbd805a62d011ed09c5a7f Mon Sep 17 00:00:00 2001 From: wdhg Date: Mon, 20 Sep 2021 21:10:27 +0100 Subject: [PATCH 5/9] Remove extra mono --- src/client/extension.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/client/extension.ts b/src/client/extension.ts index f37ee9a..805ad0b 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -96,7 +96,6 @@ export async function activate(context: ExtensionContext) { if (process.arch === "arm64") { // desired command: mono --assembly-loader=strict Omnisharp.exe args.unshift('--assembly-loader=strict') - args.unshift('mono') serverOptions = { command: "mono", From 484a57d359a43004aa1b36a0190a3a9ccab5e806 Mon Sep 17 00:00:00 2001 From: wdhg Date: Mon, 20 Sep 2021 21:17:21 +0100 Subject: [PATCH 6/9] Append omnisharp executable --- src/client/extension.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client/extension.ts b/src/client/extension.ts index 805ad0b..01fb47c 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -96,6 +96,7 @@ export async function activate(context: ExtensionContext) { if (process.arch === "arm64") { // desired command: mono --assembly-loader=strict Omnisharp.exe args.unshift('--assembly-loader=strict') + args.push(omnisharpExe) serverOptions = { command: "mono", From e8f20aa25b7e94081bb760cac675f4f19c31e324 Mon Sep 17 00:00:00 2001 From: wdhg Date: Mon, 20 Sep 2021 21:19:39 +0100 Subject: [PATCH 7/9] Try using full path of mono executable --- src/client/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/extension.ts b/src/client/extension.ts index 01fb47c..981cbc7 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -99,7 +99,7 @@ export async function activate(context: ExtensionContext) { args.push(omnisharpExe) serverOptions = { - command: "mono", + command: "/usr/local/bin/mono", args: args, options: {cwd: workspace.rootPath} } From 4482d483204a8e01cdc28b3b989a44810c1d8a3b Mon Sep 17 00:00:00 2001 From: wdhg Date: Mon, 20 Sep 2021 21:31:03 +0100 Subject: [PATCH 8/9] Fix args ordering, improve mono check --- src/client/extension.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/extension.ts b/src/client/extension.ts index 981cbc7..f490974 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -93,13 +93,13 @@ export async function activate(context: ExtensionContext) { let serverOptions; - if (process.arch === "arm64") { + if (omnisharpExe.indexOf("mono") !== -1) { // desired command: mono --assembly-loader=strict Omnisharp.exe + args.unshift(omnisharpExe) args.unshift('--assembly-loader=strict') - args.push(omnisharpExe) serverOptions = { - command: "/usr/local/bin/mono", + command: "mono", args: args, options: {cwd: workspace.rootPath} } From 7d54bc8de2754190e6091d776ae510eb1471a37c Mon Sep 17 00:00:00 2001 From: wdhg Date: Wed, 22 Sep 2021 23:12:15 +0100 Subject: [PATCH 9/9] Use osx version instead of mono version --- src/client/extension.ts | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/client/extension.ts b/src/client/extension.ts index f490974..d5f77a0 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -36,7 +36,7 @@ const omnisharpPacks: ILanguageServerPackages = { "win-x64": { platformPath: "omnisharp-win-x64.zip", executable: "Omnisharp.exe" }, "linux-x64": { platformPath: "omnisharp-linux-x64.zip", executable: "run" }, "osx-x64": { platformPath: "omnisharp-osx.zip", executable: "run" }, - "osx-arm64": { platformPath: "omnisharp-mono.zip", executable: "Omnisharp.exe" }, + "osx-arm64": { platformPath: "omnisharp-osx.zip", executable: "run" }, } export async function activate(context: ExtensionContext) { @@ -91,24 +91,10 @@ export async function activate(context: ExtensionContext) { } - let serverOptions; - - if (omnisharpExe.indexOf("mono") !== -1) { - // desired command: mono --assembly-loader=strict Omnisharp.exe - args.unshift(omnisharpExe) - args.unshift('--assembly-loader=strict') - - serverOptions = { - command: "mono", - args: args, - options: {cwd: workspace.rootPath} - } - } else { - serverOptions = { - command: omnisharpExe, - args: args, - options: {cwd: workspace.rootPath} - } + let serverOptions = { + command: omnisharpExe, + args: args, + options: {cwd: workspace.rootPath} }