Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected updateColoringDecorators(uri: string, infos: ColoringInformation[], uriToColoringDecorationIdsMap: Map) {
let modelUri = monaco.Uri.parse(uri)
let model = monaco.editor.getModel(modelUri)
if (is.undefined(model) || is.nil(model)) {
return;
}
const decorationIdsToRemove = uriToColoringDecorationIdsMap.get(uri);
if (decorationIdsToRemove) {
while (decorationIdsToRemove.length !== 0) {
const oldId = decorationIdsToRemove.pop();
model.deltaDecorations([oldId], []);
}
}
const newDecorationIds: string[] = [];
infos.forEach(info => {
const monacoRange = protocolConverter.asRange(info.range);
info.styles.forEach(style => {
const cssClass = ColoringIdToCssStyleMap.map.get(style);
protected updateMarkers(uri: string, diagnostics: lstypes.Diagnostic[]): void {
let modelUri = monaco.Uri.parse(uri)
let model = monaco.editor.getModel(modelUri)
if (is.undefined(model) || is.nil(model)) {
return;
}
let markers: monaco.editor.IMarkerData[] = []
if (is.defined(diagnostics) && !is.nil(diagnostics)) {
markers = diagnostics.map(protocolConverter.asMarker)
}
monaco.editor.setModelMarkers(model, 'LanguageClient', markers)
}
protected updateMarkers(uri: string, diagnostics: lstypes.Diagnostic[]): void {
let modelUri = monaco.Uri.parse(uri)
let model = monaco.editor.getModel(modelUri)
if (is.undefined(model) || is.nil(model)) {
return;
}
let markers: monaco.editor.IMarkerData[] = []
if (is.defined(diagnostics) && !is.nil(diagnostics)) {
markers = diagnostics.map(protocolConverter.asMarker)
}
monaco.editor.setModelMarkers(model, 'LanguageClient', markers)
}
protected filterTextDocument(textDocument: lstypes.TextDocument, acceptor: (textDocument: lstypes.TextDocument) => void) {
if (is.undefined(textDocument)) {
return;
}
if (is.nil(textDocument)) {
return;
}
if (!this.isLanguageSupported(textDocument.languageId)) {
return;
}
acceptor(textDocument);
}
protected onDidChangeTextDocument(textDocument: lstypes.TextDocument, contentChanges?: lstypes.TextDocumentContentChangeEvent[]): void {
const params = languageConverter.asDidChangeTextDocumentParams(textDocument);
if (this._capabilites.textDocumentSync === protocol.TextDocumentSyncKind.Incremental) {
if (is.defined(contentChanges) && !is.nil(contentChanges)) {
params.contentChanges = contentChanges.map((change) => {
return languageConverter.asTextDocumentContentChangeEvent(change);
})
}
}
this.props.connection.sendNotification(protocol.DidChangeTextDocumentNotification.type, params);
}