Skip to content

Commit

Permalink
Merge pull request #79962 from microsoft/pine/css-deprecated
Browse files Browse the repository at this point in the history
Add middleware for processing deprecated. Fix #79584
  • Loading branch information
octref authored Aug 28, 2019
2 parents e493a50 + afe281c commit eeab6fc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
29 changes: 28 additions & 1 deletion extensions/css-language-features/client/src/cssMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import * as fs from 'fs';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();

import { languages, window, commands, ExtensionContext, Range, Position, CompletionItem, CompletionItemKind, TextEdit, SnippetString, workspace } from 'vscode';
import { languages, window, commands, ExtensionContext, Range, Position, CompletionItem, CompletionItemKind, TextEdit, SnippetString, workspace, CompletionItemTag } from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, Disposable } from 'vscode-languageclient';
import { getCustomDataPathsInAllWorkspaces, getCustomDataPathsFromAllExtensions } from './customData';
import { isArray } from 'util';

// this method is called when vs code is activated
export function activate(context: ExtensionContext) {
Expand Down Expand Up @@ -44,6 +45,32 @@ export function activate(context: ExtensionContext) {
},
initializationOptions: {
dataPaths
},
middleware: {
async provideCompletionItem(document, position, context, token, next) {
const result = await next(document, position, context, token);
if (result) {
if (isArray(result)) {
return result.map(r => {
return {
...r,
tags: (r as any).deprecated ? [CompletionItemTag.Deprecated] : undefined
};
});
} else {
return {
isIncomplete: result.isIncomplete,
items: result.items.map(r => {
return {
...r,
tags: (r as any).deprecated ? [CompletionItemTag.Deprecated] : undefined
};
})
};
}
}
return result;
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion extensions/css-language-features/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"main": "./out/cssServerMain",
"dependencies": {
"vscode-css-languageservice": "^4.0.3-next.4",
"vscode-css-languageservice": "^4.0.3-next.6",
"vscode-languageserver": "^5.3.0-next.8"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions extensions/css-language-features/server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,10 @@ supports-color@^5.3.0:
dependencies:
has-flag "^3.0.0"

vscode-css-languageservice@^4.0.3-next.4:
version "4.0.3-next.4"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.4.tgz#3f0ccf116567650597b5cbfd8ce09846a64dec13"
integrity sha512-9eaKw6ez+l407/uzIho51ElMqGSJcOV+M5B/HmAtdBPSc/chkAfx3r7zXOqrAlLKsBzZNVpnsA3C3YDjyZbrdg==
vscode-css-languageservice@^4.0.3-next.6:
version "4.0.3-next.6"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.6.tgz#c9b70ae6dc7418d080188ba9772bf47343b929e7"
integrity sha512-Ip9EzhgZmwYEmmTw4oIN8oaZ1gUEJqVDrfcvPJ/bfc9lcYeSxexQ+9O5TiF106nX2g5f93sWYX/rDiAhxSgf4A==
dependencies:
vscode-languageserver-types "^3.15.0-next.2"
vscode-nls "^4.1.1"
Expand Down

0 comments on commit eeab6fc

Please sign in to comment.