Skip to content

Commit bb20a40

Browse files
authored
Merge pull request vunguyentuan#47 from vunguyentuan/improve-ux
Improve ux
2 parents f08bc06 + c949e27 commit bb20a40

File tree

8 files changed

+64
-66
lines changed

8 files changed

+64
-66
lines changed

.changeset/six-wolves-admire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"css-variables-language-server": patch
3+
---
4+
5+
remove commit characters as it confuse some users

.changeset/sweet-tables-happen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"vscode-css-variables": patch
3+
---
4+
5+
update activated documents, avoid trigger autocomplete on irrelevant files

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ node_modules
55
.turbo
66
dist
77
out
8-
.DS_Store
8+
.DS_Store
9+
10+
./packages/vscode-css-variables/README.md

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,33 @@ You can easily knows where the variable coming from by hold Alt/Cmd and click to
5454

5555
<img src="https://github.com/vunguyentuan/vscode-css-variables/raw/master/demo/goto-definition-trim.gif" alt="" />
5656

57+
## FAQ
58+
### I want to add files in `node_modules` folder
59+
*.vscode/settings.json*
60+
```json
61+
{
62+
"cssVariables.lookupFiles": [
63+
"**/*.css",
64+
"**/*.scss",
65+
"**/*.sass",
66+
"**/*.less",
67+
"node_modules/open-props/open-props.min.css"
68+
]
69+
}
70+
```
71+
72+
### I want to add files from public url, CDN
73+
*src/style.css*
74+
```css
75+
@import 'https://cdn.jsdelivr.net/gh/KunalTanwar/tailwind-colors/dist/css/colors.min.css';
76+
77+
body {
78+
color: var(--indigo-50);
79+
}
80+
81+
...
82+
```
83+
84+
### Example source code https://github.com/vunguyentuan/test-css-var
5785
## Full demo
5886
![Demo](https://github.com/vunguyentuan/vscode-css-variables/raw/master/demo/demo.v2.3.0.gif)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"dev": "turbo run dev",
1313
"package": "turbo run package",
1414
"deploy": "turbo run deploy",
15-
"release": "npm run build && changeset publish"
15+
"release": "cp README.md packages/vscode-css-variables/README.md && npm run build && changeset publish"
1616
},
1717
"devDependencies": {
1818
"@changesets/cli": "^2.24.3",

packages/css-variables-language-server/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ connection.onCompletion(
192192
label: varSymbol.name,
193193
detail: varSymbol.value,
194194
documentation: varSymbol.value,
195-
commitCharacters: [' ', ';', '{', '}'],
196195
insertText,
197196
kind: isColor(varSymbol.value)
198197
? CompletionItemKind.Color

packages/vscode-css-variables/README.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

packages/vscode-css-variables/src/index.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ let client: LanguageClient;
1717

1818
export function activate(context: ExtensionContext) {
1919
// The server is implemented in node
20-
const serverModule = context.asAbsolutePath(
21-
path.join('dist', 'server.js'),
22-
);
20+
const serverModule = context.asAbsolutePath(path.join('dist', 'server.js'));
2321

2422
// The debug options for the server
2523
// --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
@@ -38,7 +36,26 @@ export function activate(context: ExtensionContext) {
3836

3937
// Options to control the language client
4038
const clientOptions: LanguageClientOptions = {
41-
documentSelector: [{ scheme: 'file' }, { scheme: 'untitled' }],
39+
documentSelector: [
40+
'onLanguage:astro',
41+
'onLanguage:svelte',
42+
'onLanguage:vue',
43+
'onLanguage:vue-html',
44+
'onLanguage:vue-postcss',
45+
'onLanguage:scss',
46+
'onLanguage:postcss',
47+
'onLanguage:less',
48+
'onLanguage:css',
49+
'onLanguage:html',
50+
'onLanguage:javascript',
51+
'onLanguage:javascriptreact',
52+
'onLanguage:typescript',
53+
'onLanguage:typescriptreact',
54+
'onLanguage:source.css.styled',
55+
].map((event) => ({
56+
scheme: 'file',
57+
language: event.split(':')[1],
58+
})),
4259
synchronize: {
4360
fileEvents: [
4461
workspace.createFileSystemWatcher('**/*.css'),
@@ -54,7 +71,7 @@ export function activate(context: ExtensionContext) {
5471
'cssVariables',
5572
'CSS Variables Language Server',
5673
serverOptions,
57-
clientOptions,
74+
clientOptions
5875
);
5976

6077
// Start the client. This will also launch the server

0 commit comments

Comments
 (0)