Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I get the little color icon next to color names in my custom language? #38959

Closed
tempit opened this issue Nov 22, 2017 · 4 comments
Closed
Assignees
Labels
css-less-scss Issues and items concerning CSS,Less,SCSS styling

Comments

@tempit
Copy link

tempit commented Nov 22, 2017

Writing an LSP extension for our CSS preprocessor, I notice that when I get a color completion from CSS (I proxy the CSS service through mine) I get the little color indicator next to the value, but in the file itself there is no indicator (see pic).

image

I haven't found anything in the LS Protocol or in TM grammars to make this possible in my language.
Is it at all possible to get the color icon through an extension / grammar, or is it a special VSCode feature for CSS only?

  • VSCode Version: 1.18.1
  • OS Version: Ubuntu 16.04

Reproduces without extensions: Yes/No

@vscodebot vscodebot bot added the css-less-scss Issues and items concerning CSS,Less,SCSS styling label Nov 22, 2017
@aeschli
Copy link
Contributor

aeschli commented Nov 23, 2017

It's a proposed protocol extension. See
https://github.com/Microsoft/vscode-languageserver-node/blob/master/protocol/src/protocol.colorProvider.proposed.md
Check out the css client and server on how to use it.

@aeschli aeschli closed this as completed Nov 23, 2017
@tempit
Copy link
Author

tempit commented Nov 23, 2017

Is it possible the vscode.d.ts version that is downloaded doesn't have these features?
I can't find languages.registerColorProvider, and get multiple errors from vscode-langugeclient:

node_modules/vscode-languageclient/lib/client.d.ts(1,139): error TS2305: Module '"/home/wix/projects/stylable-intelligence/packages/client/node_modules/vscode/vscode"' has no exported member 'ProviderResult'.
node_modules/vscode-languageclient/lib/client.d.ts(1,272): error TS2305: Module '"/home/wix/projects/stylable-intelligence/packages/client/node_modules/vscode/vscode"' has no exported member 'CompletionList'.
node_modules/vscode-languageclient/lib/client.d.ts(1,648): error TS2305: Module '"/home/wix/projects/stylable-intelligence/packages/client/node_modules/vscode/vscode"' has no exported member 'DocumentLink'.
node_modules/vscode-languageclient/lib/client.d.ts(1,679): error TS2305: Module '"/home/wix/projects/stylable-intelligence/packages/client/node_modules/vscode/vscode"' has no exported member 'TextDocumentWillSaveEvent'.
node_modules/vscode-languageclient/lib/client.d.ts(1,706): error TS2305: Module '"/home/wix/projects/stylable-intelligence/packages/client/node_modules/vscode/vscode"' has no exported member 'WorkspaceFolder'.
node_modules/vscode-languageclient/lib/codeConverter.d.ts(11,46): error TS2694: Namespace 'vscode' has no exported member 'TextDocumentWillSaveEvent'.
node_modules/vscode-languageclient/lib/codeConverter.d.ts(36,31): error TS2694: Namespace 'vscode' has no exported member 'DocumentLink'.
node_modules/vscode-languageclient/lib/protocolConverter.d.ts(18,57): error TS2694: Namespace 'vscode' has no exported member 'CompletionList'.
node_modules/vscode-languageclient/lib/protocolConverter.d.ts(21,122): error TS2694: Namespace 'vscode' has no exported member 'CompletionList'.
node_modules/vscode-languageclient/lib/protocolConverter.d.ts(66,49): error TS2694: Namespace 'vscode' has no exported member 'DocumentLink'.
node_modules/vscode-languageclient/lib/protocolConverter.d.ts(67,53): error TS2694: Namespace 'vscode' has no exported member 'DocumentLink'.
node_modules/vscode-languageclient/lib/protocolConverter.d.ts(69,72): error TS2694: Namespace 'vscode' has no exported member 'DocumentLink'.
node_modules/vscode-languageclient/lib/workspaceFolders.proposed.d.ts(1,10): error TS2305: Module '"/home/wix/projects/stylable-intelligence/packages/client/node_modules/vscode/vscode"' has no exported member 'WorkspaceFoldersChangeEvent'.

@aeschli
Copy link
Contributor

aeschli commented Nov 23, 2017

It's in 1.18. Make sure that you have

"engines": {
    "vscode": "1.18.x"
  },

in your extension's package.jsonand do a npm install to get vscode.d.ts updated.

@tempit
Copy link
Author

tempit commented Nov 23, 2017

Thanks. My engine was outdated.
You can close #39036 as well, it's the same issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
css-less-scss Issues and items concerning CSS,Less,SCSS styling
Projects
None yet
Development

No branches or pull requests

2 participants