Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions client/src/monaco-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -639,25 +639,25 @@ export class ProtocolToMonacoConverter {
}

asCodeAction(item: Command | CodeAction): ProtocolCodeAction {
if (CodeAction.is(item)) {
if (Command.is(item)) {
return {
title: item.title,
command: this.asCommand(item.command),
edit: this.asWorkspaceEdit(item.edit),
diagnostics: this.asDiagnostics(item.diagnostics),
kind: item.kind,
disabled: item.disabled ? item.disabled.reason : undefined,
isPreferred: item.isPreferred,
data: item.data
command: {
id: item.command,
title: item.title,
arguments: item.arguments
},
title: item.title
};
}
return {
command: {
id: item.command,
title: item.title,
arguments: item.arguments
},
title: item.title
title: item.title,
command: this.asCommand(item.command),
edit: this.asWorkspaceEdit(item.edit),
diagnostics: this.asDiagnostics(item.diagnostics),
kind: item.kind,
disabled: item.disabled ? item.disabled.reason : undefined,
isPreferred: item.isPreferred,
data: item.data
};
}

Expand Down
30 changes: 11 additions & 19 deletions client/src/monaco-languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
OnTypeFormattingEditProvider, RenameProvider,
DocumentFilter, DocumentSelector, DocumentLinkProvider, ImplementationProvider, TypeDefinitionProvider, DocumentColorProvider,
FoldingRangeProvider, SemanticTokensLegend,
DocumentSemanticTokensProvider, DocumentRangeSemanticTokensProvider, Command
DocumentSemanticTokensProvider, DocumentRangeSemanticTokensProvider
} from "./services";

import { MonacoDiagnosticCollection } from './monaco-diagnostic-collection';
Expand Down Expand Up @@ -248,25 +248,17 @@ export class MonacoLanguages implements Languages {
}
const params = this.m2p.asCodeActionParams(model, range, context);
let result = await provider.provideCodeActions(params, token);

// FIXME: get rid of it and implement resolveCodeAction when https://github.com/microsoft/monaco-editor/issues/2663 is resolved
return result && this.p2m.asCodeActionList(result);
},
resolveCodeAction: provider.resolveCodeAction ? async (codeAction, token) => {
const params = this.m2p.asCodeAction(codeAction);
const result = await provider.resolveCodeAction!(params, token);
if (result) {
if (provider.resolveCodeAction) {
result = await Promise.all(result.map(async item => {
if (!Command.is(item) && !item.edit) {
const resolved = await provider.resolveCodeAction!(item, token)
if (resolved) {
return resolved
}
}
return item
}))
}

return this.p2m.asCodeActionList(result)
const resolvedCodeAction = this.p2m.asCodeAction(result);
Object.assign(codeAction, resolvedCodeAction);
}
return undefined
}
return codeAction;
} : undefined
}
}

Expand Down Expand Up @@ -300,7 +292,7 @@ export class MonacoLanguages implements Languages {
Object.assign(codeLens, resolvedCodeLens);
}
return codeLens;
} : ((_, codeLens) => codeLens)
} : undefined
}
}

Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@codingame/monaco-jsonrpc": "^0.3.1",
"express": "^4.15.2",
"file-loader": "^4.3.0",
"monaco-editor-core": "^0.22.3",
"monaco-editor-core": "^0.29.0",
"@codingame/monaco-languageclient": "^0.14.0",
"normalize-url": "^2.0.1",
"reconnecting-websocket": "^3.2.2",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@types/vscode": "1.52.0",
"css-loader": "^0.28.11",
"lerna": "^3.16.4",
"monaco-editor-core": "^0.22.3",
"monaco-editor-core": "^0.29.0",
"rimraf": "^2.6.2",
"source-map-loader": "^0.2.3",
"style-loader": "^0.20.3",
Expand Down
19 changes: 15 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@
dependencies:
vscode-jsonrpc "^6.0.0"

"@codingame/monaco-languageclient@^0.14.0":
version "0.14.0"
resolved "https://registry.yarnpkg.com/@codingame/monaco-languageclient/-/monaco-languageclient-0.14.0.tgz#d5cf712e5ee58159ec443f821503dbf8287badb8"
integrity sha512-4KBN/GmfXqALSORrCC6O1gKPpRHvA1pi2Psma/VniG1vPpAsUHQunfL1mGOw3OWd9W1v1yRZzt+wnHB1P14UuA==
dependencies:
glob-to-regexp "^0.4.1"
vscode-jsonrpc "6.0.0"
vscode-languageclient "7.0.0"
vscode-languageserver-textdocument "^1.0.1"
vscode-uri "^3.0.2"

"@evocateur/libnpmaccess@^3.1.2":
version "3.1.2"
resolved "https://registry.yarnpkg.com/@evocateur/libnpmaccess/-/libnpmaccess-3.1.2.tgz#ecf7f6ce6b004e9f942b098d92200be4a4b1c845"
Expand Down Expand Up @@ -4776,10 +4787,10 @@ modify-values@^1.0.0:
resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022"
integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==

monaco-editor-core@^0.22.3:
version "0.22.3"
resolved "https://registry.yarnpkg.com/monaco-editor-core/-/monaco-editor-core-0.22.3.tgz#decb2d53d4c87f1d838c4a78e27570f9aca2ecbd"
integrity sha512-QUA8fbVz769QBR5Xp8vKJngJM35PRvMuqDjVSsM5IJfWwwVEsQAKu/8SUD3jcEHfnE4YgQfeLktapBwJvWntgw==
monaco-editor-core@^0.29.0:
version "0.29.1"
resolved "https://registry.yarnpkg.com/monaco-editor-core/-/monaco-editor-core-0.29.1.tgz#187bd48b4c0eef7dd4c60e012ad5df4823cfdc74"
integrity sha512-A2+iNWf2Jhy/yAJ8HaDIszEhAlS1xjLvQfbk41yAyGwC4wDwbcTymUud1g0I9nV31S1x7QlXNC0BABc2uZN1Qg==

move-concurrently@^1.0.1:
version "1.0.1"
Expand Down