@codingame/monaco-languageclient
Advanced tools
Comparing version 0.14.0 to 0.15.1
@@ -219,9 +219,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
// FIXME: get rid of `!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved | ||
return undefined; | ||
} | ||
const params = this.m2p.asCodeActionParams(model, range, context); | ||
const result = yield provider.provideCodeActions(params, token); | ||
// FIXME: get rid of `|| undefined!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved | ||
return result && this.p2m.asCodeActionList(result) || undefined; | ||
let result = yield provider.provideCodeActions(params, token); | ||
// FIXME: get rid of it and implement resolveCodeAction when https://github.com/microsoft/monaco-editor/issues/2663 is resolved | ||
if (result) { | ||
if (provider.resolveCodeAction) { | ||
result = yield Promise.all(result.map((item) => __awaiter(this, void 0, void 0, function* () { | ||
if (!services_1.Command.is(item) && !item.edit) { | ||
const resolved = yield provider.resolveCodeAction(item, token); | ||
if (resolved) { | ||
return resolved; | ||
} | ||
} | ||
return item; | ||
}))); | ||
} | ||
return this.p2m.asCodeActionList(result); | ||
} | ||
return undefined; | ||
}) | ||
@@ -228,0 +241,0 @@ }; |
@@ -68,4 +68,5 @@ import { DocumentSelector, MessageActionItem, MessageType, TextDocumentPositionParams, ReferenceParams, CodeActionParams, CodeLensParams, DocumentFormattingParams, DocumentRangeFormattingParams, DocumentOnTypeFormattingParams, RenameParams, DocumentLinkParams, WorkspaceClientCapabilities, Diagnostic, CompletionItem, CompletionList, Hover, SignatureHelp, Definition, Location, DocumentHighlight, SymbolInformation, Command, CodeLens, TextEdit, WorkspaceEdit, DocumentLink, TextDocumentSaveReason, DocumentSymbolParams, WorkspaceSymbolParams, TextDocumentContentChangeEvent, CompletionParams, ColorInformation, ColorPresentation, DocumentColorParams, ColorPresentationParams, FoldingRange, FoldingRangeParams, DocumentSymbol, CodeAction, Declaration, SelectionRangeParams, SelectionRange, SemanticTokensParams, SemanticTokens, SemanticTokensEdit, SemanticTokensLegend, SemanticTokensRangeParams, SemanticTokensDeltaParams } from 'vscode-languageserver-protocol'; | ||
} | ||
export interface CodeActionProvider { | ||
export interface CodeActionProvider<T extends CodeAction = CodeAction> { | ||
provideCodeActions(params: CodeActionParams, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>; | ||
resolveCodeAction?(codeAction: T, token: CancellationToken): ProviderResult<T>; | ||
} | ||
@@ -72,0 +73,0 @@ export interface CodeLensProvider { |
@@ -414,3 +414,6 @@ /* -------------------------------------------------------------------------------------------- | ||
return provider.provideCodeActions(textDocument, range, context, token); | ||
} | ||
}, | ||
resolveCodeAction: provider.resolveCodeAction ? (codeAction, token) => { | ||
return provider.resolveCodeAction(codeAction, token); | ||
} : undefined | ||
}); | ||
@@ -417,0 +420,0 @@ }, |
@@ -222,9 +222,22 @@ "use strict"; | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
// FIXME: get rid of `!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved | ||
return undefined; | ||
} | ||
const params = this.m2p.asCodeActionParams(model, range, context); | ||
const result = yield provider.provideCodeActions(params, token); | ||
// FIXME: get rid of `|| undefined!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved | ||
return result && this.p2m.asCodeActionList(result) || undefined; | ||
let result = yield provider.provideCodeActions(params, token); | ||
// FIXME: get rid of it and implement resolveCodeAction when https://github.com/microsoft/monaco-editor/issues/2663 is resolved | ||
if (result) { | ||
if (provider.resolveCodeAction) { | ||
result = yield Promise.all(result.map((item) => __awaiter(this, void 0, void 0, function* () { | ||
if (!services_1.Command.is(item) && !item.edit) { | ||
const resolved = yield provider.resolveCodeAction(item, token); | ||
if (resolved) { | ||
return resolved; | ||
} | ||
} | ||
return item; | ||
}))); | ||
} | ||
return this.p2m.asCodeActionList(result); | ||
} | ||
return undefined; | ||
}) | ||
@@ -231,0 +244,0 @@ }; |
@@ -68,4 +68,5 @@ import { DocumentSelector, MessageActionItem, MessageType, TextDocumentPositionParams, ReferenceParams, CodeActionParams, CodeLensParams, DocumentFormattingParams, DocumentRangeFormattingParams, DocumentOnTypeFormattingParams, RenameParams, DocumentLinkParams, WorkspaceClientCapabilities, Diagnostic, CompletionItem, CompletionList, Hover, SignatureHelp, Definition, Location, DocumentHighlight, SymbolInformation, Command, CodeLens, TextEdit, WorkspaceEdit, DocumentLink, TextDocumentSaveReason, DocumentSymbolParams, WorkspaceSymbolParams, TextDocumentContentChangeEvent, CompletionParams, ColorInformation, ColorPresentation, DocumentColorParams, ColorPresentationParams, FoldingRange, FoldingRangeParams, DocumentSymbol, CodeAction, Declaration, SelectionRangeParams, SelectionRange, SemanticTokensParams, SemanticTokens, SemanticTokensEdit, SemanticTokensLegend, SemanticTokensRangeParams, SemanticTokensDeltaParams } from 'vscode-languageserver-protocol'; | ||
} | ||
export interface CodeActionProvider { | ||
export interface CodeActionProvider<T extends CodeAction = CodeAction> { | ||
provideCodeActions(params: CodeActionParams, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>; | ||
resolveCodeAction?(codeAction: T, token: CancellationToken): ProviderResult<T>; | ||
} | ||
@@ -72,0 +73,0 @@ export interface CodeLensProvider { |
@@ -419,3 +419,6 @@ "use strict"; | ||
return provider.provideCodeActions(textDocument, range, context, token); | ||
} | ||
}, | ||
resolveCodeAction: provider.resolveCodeAction ? (codeAction, token) => { | ||
return provider.resolveCodeAction(codeAction, token); | ||
} : undefined | ||
}); | ||
@@ -422,0 +425,0 @@ }, |
{ | ||
"name": "@codingame/monaco-languageclient", | ||
"version": "0.14.0", | ||
"version": "0.15.1", | ||
"description": "Monaco Language client implementation", | ||
@@ -5,0 +5,0 @@ "author": "TypeFox GmbH (http://www.typefox.io)", |
@@ -14,3 +14,3 @@ /* -------------------------------------------------------------------------------------------- | ||
FoldingRangeProvider, SemanticTokensLegend, | ||
DocumentSemanticTokensProvider, DocumentRangeSemanticTokensProvider | ||
DocumentSemanticTokensProvider, DocumentRangeSemanticTokensProvider, Command | ||
} from "./services"; | ||
@@ -248,9 +248,24 @@ | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
// FIXME: get rid of `!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved | ||
return undefined!; | ||
return undefined; | ||
} | ||
const params = this.m2p.asCodeActionParams(model, range, context); | ||
const result = await provider.provideCodeActions(params, token); | ||
// FIXME: get rid of `|| undefined!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved | ||
return result && this.p2m.asCodeActionList(result) || undefined!; | ||
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 | ||
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) | ||
} | ||
return undefined | ||
} | ||
@@ -257,0 +272,0 @@ } |
@@ -136,4 +136,5 @@ /* -------------------------------------------------------------------------------------------- | ||
export interface CodeActionProvider { | ||
export interface CodeActionProvider<T extends CodeAction = CodeAction> { | ||
provideCodeActions(params: CodeActionParams, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>; | ||
resolveCodeAction?(codeAction: T, token: CancellationToken): ProviderResult<T>; | ||
} | ||
@@ -140,0 +141,0 @@ |
@@ -437,3 +437,6 @@ /* -------------------------------------------------------------------------------------------- | ||
return provider.provideCodeActions(<any>textDocument, <any>range, <any>context, token) as any; | ||
} | ||
}, | ||
resolveCodeAction: provider.resolveCodeAction ? (codeAction, token) => { | ||
return provider.resolveCodeAction!(<any>codeAction, <any>token) as any | ||
} : undefined | ||
}); | ||
@@ -440,0 +443,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
947290
11152