Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
bring titlebarplus up to date
Browse files Browse the repository at this point in the history
* Merge NPM Scripts: Added configuration option to change default click action #49282

* fix #50560

* Fix getmac test (#48804)

* Cleaning up some typos in vscode.d.ts and vscode.proposed.d.ts (#50533)

* yarn.lock changes

* grid - log serialized state if restoring failed

* Fixes #50382: Align .mtku with .detected-link

* debug issues back to isidorn

* Hide interactive playground commands from command palette (fixes #49706)

* grid - drop outline as focus indication and rely on dimmed state

* grid - allow to close empty group when closing all editors of a group

* grid - get preferredSize from grid

* Fixes #43003: Cannot specify a global problemMatcher in tasks.json

* cleanup integrated terminal support for debugging

* grid - action wording tweaks

* #45663 Use core translations asset

* grid - allow to close dirty diff editor if master is still opened in same group

* Support to run npm install from a package node

* grid - log previous UI state upon error

* grid - stronger border top color

otherwise when a tab is showing in a vertical split, the border collides with the sash border

* remove todo

* do not append logLevel

#47774

* Implement Go To Next/Previous Breakpoint editor actions

* Include enabledOnly in debug model interface

* remove from schema

#47774

* #45663 fix compilations

* change openBreakpointSource to use IBreakpoint

* return passed context if resourceOrContext is not useful

* fix off by one issue

* Simplify implementation

* return context if it has a groupId

* polish

* Fixes microsoft/monaco-editor#891: Focus editor when returning from context menu

* go to next / previosu breakpoint minor polish

* Add Endgame for 1.24

* fix index computing for editor close case

* Fix #49145

- Enable/Disable viewlets by views when context
- Move viewlet enablement/disablement to views service
- Fix - adopt if a viewlet extension is disabled/removed

* Avoid command palette entry (#49340)

* [handlebars] code-folding algorithm is less useful than Indentation-based one. Fixes #48457

* use upper lang id

* Fixes #49378

* #49145 Store placeholder states for all viewlets

* Add `logicalLine` argument to `mutlicursor.insertBelow` and `mutlicursor.insertAbove`

* Removed duplicate loop

* eliminate code duplication; use resolveWorkspaceFolder()

* #45663 Get all asset types

* [css] update service

* [html] update services

* grid - fix compile

* add User-Id to marketplace build requests

* Improve rendererType description

Fixes #50617

* fix #50672

* Fixes #49173

* fix #50321

* fix #50670

* Install option not needed when we have Install and Restart Fixes #50669

* Fixes #50616, Showing/hiding details in Issue Reporter resets scroll position

* Fix #50642, fix #50673

* Issue reporter and process explorer windows should close when the parent window closes, fixes #50716

* Issue Reporter should clear the error state when selecting an extension, fixes #50702

* Extracting methods

* Make sure we update the webview's state on setState

* Avoid prompting for same file type in the same session #50537

* Use language name instead of locale in the prompt #50738

* Use correct failed error code for webview resource load error

* Mark unused parameter

* Restore restart

* Try serializing webviews even if they have not called setState

Fixes #50752

* Change parameter name to match interface name

Fixes #50745

* Fix non-serializable webviews being revived if they called setState

* Include recommended extensions in telemetry events to determine success

* Fix #49777 - Emmet balance In after balance out should go back to initial selection and not first child (#49996)

* Update Emmet - balance.ts

* Cover all cases

* Update prompt msg Fixes #50738

* Fix #50632

* search-rg has no icon

* EH search - replace search.enableSearchProviders with a search-rg specific setting

* fix #50742

* fix #50691

* part of #50760

* smoke: uncomment debug suite

* smoketest: use yarn

* grid - allow to close empty groups via middle click (#50733)

* careful with path comparisons on windows

related to #50760

* smoke: run yarn verbose

* fix #50710

* Improve description (#43208)

* fix #50722

* Fix #50663

* Fix #47586

* fixes #50609

* fixes #50026

* 💄

* fix  #50773

* improve perf of findId and getElementById, #50575

* don't show outline when there are more then 7500 symbols, #50575

* fix typos

* polish for #50667

* fix #50700

* grid keep sizing after branch node demotion

fixes #50564

* grid - for now remove editorGroup.activeEmptyBackground

* fix #50726

* grid: resize views when branch is demoted

fixes #50675

* fix #50727

* fix #50734

* remove preview rant from search.location

* splitview: dont propagate white-sapce property

fixes #50720

* fix #50774

* Fixes #50296

* fix  #50207

* Fixes #24670: Add API to determine if the task service supports parallel task execution.

* fix #50741

* Fixes  #49400: Cannot read property 'then' of undefined

* Fix #50717

* Fix #48901

* polish debug.toolBarLocation

fixes #50786

* Fix #50717

* missing compilation

* Fix #48225

* fix #50711

* Fix errors installing extension from Welcome page (fixes #50753)

* fixes #50794

* fixes #50787

* continuous build: use vsts npm feed

* Fix for #50792: empty pre post scripts not rendered properly

* Fix #50728

* continuous build: use vsts feed

* Fix for #50792 npm exclude doesn´t work for folder names

* Move previewOptions, #50788

* build: remove npm auth

* better fix for #50710

* Revert "Merge pull request #49790 from usernamehw/raw_settings"

This reverts commit f92a162, reversing
changes made to fc710af.

* Remove unused variable

* Fix regression in C# TextMate grammar related to lambda parameters

This tweak fixes a regression recently introduced in the C# TextMate grammar around
implicitly-typed lambda parameters.

* dotnet/csharp-tmLanguage#119
* dotnet/csharp-tmLanguage#120

* Fix parameter not being escaped

Fixes #49057

* wip: grid.getNeighborViews

* Make sure we use normalized path for compare

Fixes #50760

(the path should already have been normalized at this point so I don't think there is any user impact)

* Clean up importModuleSpecifier wording

Fixes #50817

* Remove duplicate strings and small cleanup

* Spelling fix Ouoting -> Quoting

* Restore default settings editor keybinding

* Dont trigger emmet for # in selectors Fixes #49269

* Hide settings editor feedback button in stable

* Use better colors for markdown code blocks

* Moving webview api back to proposed for more polishing

#49022

* Shorten showUnused setting name

Fixes #50648

* fix #50678

* Don't include imports in js/ts document symbol results

Fixes #50829

* smoketest: remove verbose from yarn

* smoketest: clear state from failing search tests

* minor rename

* Fix markdown preview not setting context properly on first creation

Fixes #50558

* smoketest: update to package-lock.json

fixes #50857

* smoketest: bring back search tests

* #48901 Expand by default only in custom viewlets

* fixes #50812

* open editors: clear focus when group without editors is active

fixes #50563

* Fix MaxNumber incrementFileName bug

* Fixes #48758: Do not import standalone editor modules

* fixes #50864

* Use `MAX_SAFE_SMALL_INTEGER`

* Fixes #50858: Task api is still marked as proposed

* fixes #50737

* fix #50867

* Fix: showQuickPick keeps showing infinite progress (fixes #50863)

* Clarify for translation (fixes #50634)

* fixes #50870

* fix #50479

* grid - todo@grid => todo@ben

* grid - adopt new getNeighborViews() method

* grid - add workbench.action.closeEditorsAndGroup

* open editors: close group action

fixes #50625

* open editors: use actionRunner for contexts

fixes #50621

* [css][html] update service

* grid: getNeighborViews

* grid - adopt wrapping

* Some menu action clients (ActionBar) handle alternative actions on their own so the alternative actions should be ignored

fixes #50581

* fillInActionBarActions and fillInContextMenuActions for clarity

* Remove inconsistent use of active in terminal API

Related #48434

* Try using fixAllDescription for js/ts quick fixes

Fixes #42549

* Fixes #50828, code-insiders --status triggered exception in main process

* Pick up ts 2.9.1 final

* Fix for #50868 and #50884

* Still gray out vars even if user has disabled suggestions

Fixes #50890

* grid: fix neighbor npe issue

* grid: more getNeighborViews tests

* grid: use boundaries for neighbor finding

* grid: getNeighborViews perf

* grid: add todo

* 2018-05-31. Merged in translations from Transifex.

* Update GDPR annotation

* update message

* Add specific `refactor.move` scope for js/ts move to new file action

* Use localized language name when available

* Add proper contribution schema for ts server pluguins

#50682

* Fix extra word

* Fix #50909 - add link to new settings editor from old one

* Left-align settings editor preview prompt

* grid - fix issues with touchbar updating

* grid - use viewColumnToEditorGroup in more places

* grid - close all groups should preserve first group

* Reapply fix for #50790

* grid - assign some default keybindings for focus group

* Fixes #50763: All running Visual Studio code instances shutdown all at once

* grid - 💄

* fixes #50926

* show alternative actions when alt is pressed, not only on mouse over

* open editors: click on groups should activate them

* update description (for #50677)

* Fix #50835

* grid - tweak some groups access order

* one more time, fix #50321

* beware of keybinding command null arguments

fixes #50821

* grid - prevent multiple confirmation dialogs for the same editor to show up (for  #50539)

* smoketest: go-to-definition is flaky

fixes #50944
fixes #49107

* Fixes #50943: TSC version 2.9.x in watch mode prints different end compile message

* grid - fix bad === for editors

* 💄 grid, cleanup getViews()

* Update distro commit and third party notices

* Use localizedLanguageName instead of languageNameLocalized which doesnt exist

* Remove now unneeded any

* Make sure unused diags are still updated when suggestions are disabled

Fixes #50890

* Fix unused var

* Update version

* Update issue templates, #49380

* Fix #50893 - escape regex chars when copy search string from editor

* Fix #50985 - don't take editor text when toggling search details
  • Loading branch information
bpasero authored and sbatten committed Jun 4, 2018
1 parent 5d5ad6f commit 684f987
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 114 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"node": "*"
},
"dependencies": {
"vscode-css-languageservice": "^3.0.9-next.10",
"vscode-html-languageservice": "^2.1.3-next.3",
"vscode-languageserver": "^4.0.0",
"vscode-languageserver-protocol-foldingprovider": "^2.0.0-next.2",
"vscode-languageserver-types": "^3.6.1",
"vscode-css-languageservice": "^3.0.9-next.18",
"vscode-html-languageservice": "^2.1.3-next.5",
"vscode-languageserver": "^4.1.3",
"vscode-languageserver-protocol-foldingprovider": "^2.0.1",
"vscode-languageserver-types": "^3.7.2",
"vscode-nls": "^3.2.2",
"vscode-uri": "^1.0.3"
},
Expand Down
166 changes: 92 additions & 74 deletions src/htmlServerMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ documents.listen(connection);

let workspaceFolders: WorkspaceFolder[] = [];

var languageModes: LanguageModes;
let languageModes: LanguageModes;

let clientSnippetSupport = false;
let clientDynamicRegisterSupport = false;
let scopedSettingsSupport = false;
let workspaceFoldersSupport = false;
let foldingRangeLimit = Number.MAX_VALUE;

var globalSettings: Settings = {};
let globalSettings: Settings = {};
let documentSettings: { [key: string]: Thenable<Settings> } = {};
// remove document settings on close
documents.onDidClose(e => {
Expand All @@ -67,8 +67,8 @@ function getDocumentSettings(textDocument: TextDocument, needsDocumentSettings:
if (scopedSettingsSupport && needsDocumentSettings()) {
let promise = documentSettings[textDocument.uri];
if (!promise) {
let scopeUri = textDocument.uri;
let configRequestParam: ConfigurationParams = { items: [{ scopeUri, section: 'css' }, { scopeUri, section: 'html' }, { scopeUri, section: 'javascript' }] };
const scopeUri = textDocument.uri;
const configRequestParam: ConfigurationParams = { items: [{ scopeUri, section: 'css' }, { scopeUri, section: 'html' }, { scopeUri, section: 'javascript' }] };
promise = connection.sendRequest(ConfigurationRequest.type, configRequestParam).then(s => ({ css: s[0], html: s[1], javascript: s[2] }));
documentSettings[textDocument.uri] = promise;
}
Expand All @@ -80,7 +80,7 @@ function getDocumentSettings(textDocument: TextDocument, needsDocumentSettings:
// After the server has started the client sends an initialize request. The server receives
// in the passed params the rootPath of the workspace plus the client capabilities
connection.onInitialize((params: InitializeParams): InitializeResult => {
let initializationOptions = params.initializationOptions;
const initializationOptions = params.initializationOptions;

workspaceFolders = (<any>params).workspaceFolders;
if (!Array.isArray(workspaceFolders)) {
Expand All @@ -103,7 +103,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
});

function getClientCapability<T>(name: string, def: T) {
let keys = name.split('.');
const keys = name.split('.');
let c: any = params.capabilities;
for (let i = 0; c && i < keys.length; i++) {
if (!c.hasOwnProperty(keys[i])) {
Expand All @@ -119,7 +119,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
scopedSettingsSupport = getClientCapability('workspace.configuration', false);
workspaceFoldersSupport = getClientCapability('workspace.workspaceFolders', false);
foldingRangeLimit = getClientCapability('textDocument.foldingRange.rangeLimit', Number.MAX_VALUE);
let capabilities: ServerCapabilities & FoldingRangeServerCapabilities = {
const capabilities: ServerCapabilities & FoldingRangeServerCapabilities = {
// Tell the client that the server works in FULL text document sync mode
textDocumentSync: documents.syncKind,
completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: ['.', ':', '<', '"', '=', '/'] } : undefined,
Expand All @@ -142,11 +142,11 @@ connection.onInitialized((p) => {
connection.client.register(DidChangeWorkspaceFoldersNotification.type);

connection.onNotification(DidChangeWorkspaceFoldersNotification.type, e => {
let toAdd = e.event.added;
let toRemove = e.event.removed;
let updatedFolders = [];
const toAdd = e.event.added;
const toRemove = e.event.removed;
const updatedFolders = [];
if (workspaceFolders) {
for (let folder of workspaceFolders) {
for (const folder of workspaceFolders) {
if (!toRemove.some(r => r.uri === folder.uri) && !toAdd.some(r => r.uri === folder.uri)) {
updatedFolders.push(folder);
}
Expand All @@ -168,10 +168,10 @@ connection.onDidChangeConfiguration((change) => {

// dynamically enable & disable the formatter
if (clientDynamicRegisterSupport) {
let enableFormatter = globalSettings && globalSettings.html && globalSettings.html.format && globalSettings.html.format.enable;
const enableFormatter = globalSettings && globalSettings.html && globalSettings.html.format && globalSettings.html.format.enable;
if (enableFormatter) {
if (!formatterRegistration) {
let documentSelector: DocumentSelector = [{ language: 'html' }, { language: 'handlebars' }]; // don't register razor, the formatter does more harm than good
const documentSelector: DocumentSelector = [{ language: 'html' }, { language: 'handlebars' }]; // don't register razor, the formatter does more harm than good
formatterRegistration = connection.client.register(DocumentRangeFormattingRequest.type, { documentSelector });
}
} else if (formatterRegistration) {
Expand All @@ -197,7 +197,7 @@ documents.onDidClose(event => {
});

function cleanPendingValidation(textDocument: TextDocument): void {
let request = pendingValidationRequests[textDocument.uri];
const request = pendingValidationRequests[textDocument.uri];
if (request) {
clearTimeout(request);
delete pendingValidationRequests[textDocument.uri];
Expand All @@ -213,7 +213,7 @@ function triggerValidation(textDocument: TextDocument): void {
}

function isValidationEnabled(languageId: string, settings: Settings = globalSettings) {
let validationSettings = settings && settings.html && settings.html.validate;
const validationSettings = settings && settings.html && settings.html.validate;
if (validationSettings) {
return languageId === 'css' && validationSettings.styles !== false || languageId === 'javascript' && validationSettings.scripts !== false;
}
Expand All @@ -222,19 +222,19 @@ function isValidationEnabled(languageId: string, settings: Settings = globalSett

async function validateTextDocument(textDocument: TextDocument) {
try {
let version = textDocument.version;
let diagnostics: Diagnostic[] = [];
const version = textDocument.version;
const diagnostics: Diagnostic[] = [];
if (textDocument.languageId === 'html') {
let modes = languageModes.getAllModesInDocument(textDocument);
let settings = await getDocumentSettings(textDocument, () => modes.some(m => !!m.doValidation));
textDocument = documents.get(textDocument.uri);
if (textDocument && textDocument.version === version) { // check no new version has come in after in after the async op
const modes = languageModes.getAllModesInDocument(textDocument);
const settings = await getDocumentSettings(textDocument, () => modes.some(m => !!m.doValidation));
const latestTextDocument = documents.get(textDocument.uri);
if (latestTextDocument && latestTextDocument.version === version) { // check no new version has come in after in after the async op
modes.forEach(mode => {
if (mode.doValidation && isValidationEnabled(mode.getId(), settings)) {
pushAll(diagnostics, mode.doValidation(textDocument, settings));
pushAll(diagnostics, mode.doValidation(latestTextDocument, settings));
}
});
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
connection.sendDiagnostics({ uri: latestTextDocument.uri, diagnostics });
}
}
} catch (e) {
Expand All @@ -245,6 +245,9 @@ async function validateTextDocument(textDocument: TextDocument) {
connection.onCompletion(async (textDocumentPosition, token) => {
return runSafeAsync(async () => {
const document = documents.get(textDocumentPosition.textDocument.uri);
if (!document) {
return null;
}
const mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
if (!mode || !mode.doComplete) {
return { isIncomplete: true, items: [] };
Expand All @@ -260,19 +263,19 @@ connection.onCompletion(async (textDocumentPosition, token) => {
connection.telemetry.logEvent({ key: 'html.embbedded.complete', value: { languageId: mode.getId() } });
}

let settings = await getDocumentSettings(document, () => doComplete.length > 2);
let result = doComplete(document, textDocumentPosition.position, settings);
const settings = await getDocumentSettings(document, () => doComplete.length > 2);
const result = doComplete(document, textDocumentPosition.position, settings);
return result;

}, null, `Error while computing completions for ${textDocumentPosition.textDocument.uri}`, token);
});

connection.onCompletionResolve((item, token) => {
return runSafe(() => {
let data = item.data;
const data = item.data;
if (data && data.languageId && data.uri) {
let mode = languageModes.getMode(data.languageId);
let document = documents.get(data.uri);
const mode = languageModes.getMode(data.languageId);
const document = documents.get(data.uri);
if (mode && mode.doResolve && document) {
return mode.doResolve(document, item);
}
Expand All @@ -283,79 +286,92 @@ connection.onCompletionResolve((item, token) => {

connection.onHover((textDocumentPosition, token) => {
return runSafe(() => {
let document = documents.get(textDocumentPosition.textDocument.uri);
let mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
if (mode && mode.doHover) {
return mode.doHover(document, textDocumentPosition.position);
const document = documents.get(textDocumentPosition.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
if (mode && mode.doHover) {
return mode.doHover(document, textDocumentPosition.position);
}
}
return null;
}, null, `Error while computing hover for ${textDocumentPosition.textDocument.uri}`, token);
});

connection.onDocumentHighlight((documentHighlightParams, token) => {
return runSafe(() => {
let document = documents.get(documentHighlightParams.textDocument.uri);
let mode = languageModes.getModeAtPosition(document, documentHighlightParams.position);
if (mode && mode.findDocumentHighlight) {
return mode.findDocumentHighlight(document, documentHighlightParams.position);
const document = documents.get(documentHighlightParams.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, documentHighlightParams.position);
if (mode && mode.findDocumentHighlight) {
return mode.findDocumentHighlight(document, documentHighlightParams.position);
}
}
return [];
}, [], `Error while computing document highlights for ${documentHighlightParams.textDocument.uri}`, token);
});

connection.onDefinition((definitionParams, token) => {
return runSafe(() => {
let document = documents.get(definitionParams.textDocument.uri);
let mode = languageModes.getModeAtPosition(document, definitionParams.position);
if (mode && mode.findDefinition) {
return mode.findDefinition(document, definitionParams.position);
const document = documents.get(definitionParams.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, definitionParams.position);
if (mode && mode.findDefinition) {
return mode.findDefinition(document, definitionParams.position);
}
}
return [];
}, null, `Error while computing definitions for ${definitionParams.textDocument.uri}`, token);
});

connection.onReferences((referenceParams, token) => {
return runSafe(() => {
let document = documents.get(referenceParams.textDocument.uri);
let mode = languageModes.getModeAtPosition(document, referenceParams.position);
if (mode && mode.findReferences) {
return mode.findReferences(document, referenceParams.position);
const document = documents.get(referenceParams.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, referenceParams.position);
if (mode && mode.findReferences) {
return mode.findReferences(document, referenceParams.position);
}
}
return [];
}, [], `Error while computing references for ${referenceParams.textDocument.uri}`, token);
});

connection.onSignatureHelp((signatureHelpParms, token) => {
return runSafe(() => {
let document = documents.get(signatureHelpParms.textDocument.uri);
let mode = languageModes.getModeAtPosition(document, signatureHelpParms.position);
if (mode && mode.doSignatureHelp) {
return mode.doSignatureHelp(document, signatureHelpParms.position);
const document = documents.get(signatureHelpParms.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, signatureHelpParms.position);
if (mode && mode.doSignatureHelp) {
return mode.doSignatureHelp(document, signatureHelpParms.position);
}
}
return null;
}, null, `Error while computing signature help for ${signatureHelpParms.textDocument.uri}`, token);
});

connection.onDocumentRangeFormatting(async (formatParams, token) => {
return runSafeAsync(async () => {
let document = documents.get(formatParams.textDocument.uri);
let settings = await getDocumentSettings(document, () => true);
if (!settings) {
settings = globalSettings;
}
let unformattedTags: string = settings && settings.html && settings.html.format && settings.html.format.unformatted || '';
let enabledModes = { css: !unformattedTags.match(/\bstyle\b/), javascript: !unformattedTags.match(/\bscript\b/) };
const document = documents.get(formatParams.textDocument.uri);
if (document) {
let settings = await getDocumentSettings(document, () => true);
if (!settings) {
settings = globalSettings;
}
const unformattedTags: string = settings && settings.html && settings.html.format && settings.html.format.unformatted || '';
const enabledModes = { css: !unformattedTags.match(/\bstyle\b/), javascript: !unformattedTags.match(/\bscript\b/) };

return format(languageModes, document, formatParams.range, formatParams.options, settings, enabledModes);
return format(languageModes, document, formatParams.range, formatParams.options, settings, enabledModes);
}
return [];
}, [], `Error while formatting range for ${formatParams.textDocument.uri}`, token);
});

connection.onDocumentLinks((documentLinkParam, token) => {
return runSafe(() => {
let document = documents.get(documentLinkParam.textDocument.uri);
let links: DocumentLink[] = [];
const document = documents.get(documentLinkParam.textDocument.uri);
const links: DocumentLink[] = [];
if (document) {
let documentContext = getDocumentContext(document.uri, workspaceFolders);
const documentContext = getDocumentContext(document.uri, workspaceFolders);
languageModes.getAllModesInDocument(document).forEach(m => {
if (m.findDocumentLinks) {
pushAll(links, m.findDocumentLinks(document, documentContext));
Expand All @@ -368,21 +384,23 @@ connection.onDocumentLinks((documentLinkParam, token) => {

connection.onDocumentSymbol((documentSymbolParms, token) => {
return runSafe(() => {
let document = documents.get(documentSymbolParms.textDocument.uri);
let symbols: SymbolInformation[] = [];
languageModes.getAllModesInDocument(document).forEach(m => {
if (m.findDocumentSymbols) {
pushAll(symbols, m.findDocumentSymbols(document));
}
});
const document = documents.get(documentSymbolParms.textDocument.uri);
const symbols: SymbolInformation[] = [];
if (document) {
languageModes.getAllModesInDocument(document).forEach(m => {
if (m.findDocumentSymbols) {
pushAll(symbols, m.findDocumentSymbols(document));
}
});
}
return symbols;
}, [], `Error while computing document symbols for ${documentSymbolParms.textDocument.uri}`, token);
});

connection.onRequest(DocumentColorRequest.type, (params, token) => {
return runSafe(() => {
let infos: ColorInformation[] = [];
let document = documents.get(params.textDocument.uri);
const infos: ColorInformation[] = [];
const document = documents.get(params.textDocument.uri);
if (document) {
languageModes.getAllModesInDocument(document).forEach(m => {
if (m.findDocumentColors) {
Expand All @@ -396,9 +414,9 @@ connection.onRequest(DocumentColorRequest.type, (params, token) => {

connection.onRequest(ColorPresentationRequest.type, (params, token) => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
const document = documents.get(params.textDocument.uri);
if (document) {
let mode = languageModes.getModeAtPosition(document, params.range.start);
const mode = languageModes.getModeAtPosition(document, params.range.start);
if (mode && mode.getColorPresentations) {
return mode.getColorPresentations(document, params.color, params.range);
}
Expand All @@ -409,11 +427,11 @@ connection.onRequest(ColorPresentationRequest.type, (params, token) => {

connection.onRequest(TagCloseRequest.type, (params, token) => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
const document = documents.get(params.textDocument.uri);
if (document) {
let pos = params.position;
const pos = params.position;
if (pos.character > 0) {
let mode = languageModes.getModeAtPosition(document, Position.create(pos.line, pos.character - 1));
const mode = languageModes.getModeAtPosition(document, Position.create(pos.line, pos.character - 1));
if (mode && mode.doAutoClose) {
return mode.doAutoClose(document, pos);
}
Expand All @@ -425,7 +443,7 @@ connection.onRequest(TagCloseRequest.type, (params, token) => {

connection.onRequest(FoldingRangeRequest.type, (params, token) => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
const document = documents.get(params.textDocument.uri);
if (document) {
return getFoldingRanges(languageModes, document, foldingRangeLimit, token);
}
Expand Down
2 changes: 1 addition & 1 deletion src/modes/javascriptMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache<HTMLDocume
},
doValidation(document: TextDocument): Diagnostic[] {
updateCurrentTextDocument(document);
const syntaxDiagnostics = jsLanguageService.getSyntacticDiagnostics(FILE_NAME);
const syntaxDiagnostics: ts.Diagnostic[] = jsLanguageService.getSyntacticDiagnostics(FILE_NAME);
const semanticDiagnostics = jsLanguageService.getSemanticDiagnostics(FILE_NAME);
return syntaxDiagnostics.concat(semanticDiagnostics).map((diag: ts.Diagnostic): Diagnostic => {
return {
Expand Down
Loading

0 comments on commit 684f987

Please sign in to comment.