@master/css-vscode 0.0.0-stage → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +253 -2
- package/dist/extension.min.js +206 -0
- package/dist/server.min.js +219 -0
- package/icon.png +0 -0
- package/package.json +493 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Aoyue Design LLC.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,254 @@
|
|
|
1
|
-
|
|
1
|
+
<br>
|
|
2
|
+
<div align="center">
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
<p align="center">
|
|
5
|
+
<img alt="Master CSS" src="https://github.com/master-co/css/assets/33840671/fabe83d3-e882-4c7b-93f1-ca06792a6fb2" width="100%">
|
|
6
|
+
</p>
|
|
7
|
+
<p align="center">Master CSS for Visual Studio Code</p>
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
Master CSS for Visual Studio Code provides manifest-aware language features for Master CSS classes, CSS directives, and project-specific tokens. The extension starts the bundled Master CSS language server, loads the nearest project manifest, and brings completion, hover, TextMate directive highlighting, semantic class-list highlighting, color tools, directive diagnostics, and directive formatting into supported files.
|
|
12
|
+
|
|
13
|
+
For the complete VS Code workflow, use this extension together with the official VS Code ESLint extension. Master CSS owns completion, hover, colors, highlighting, directive diagnostics, manifest diagnostics, and directive formatting. ESLint owns class policy diagnostics and sort-on-save for rules such as `@master/css/sort-classes`, `@master/css/prefer-canonical-classes`, and `@master/css/no-conflicting-classes`.
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
Install [Master CSS from the Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=masterco.master-css-vscode), or use extension ID `masterco.master-css-vscode` in VS Code. Editors using [Open VSX](https://open-vsx.org/extension/master/master-css-vscode) use `master.master-css-vscode`.
|
|
18
|
+
|
|
19
|
+
Enable suggestions inside strings so utility completions appear in markup, JSX, template strings, and helper calls:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"editor.quickSuggestions": {
|
|
24
|
+
"strings": true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
For project-aware tokens, create a CSS entry that imports `@master/css`, or declare a Master CSS package dependency in the project `package.json`.
|
|
30
|
+
|
|
31
|
+
```css
|
|
32
|
+
@import "@master/css";
|
|
33
|
+
|
|
34
|
+
@theme {
|
|
35
|
+
--color-primary: #4f46e5;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.button {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 0.5rem;
|
|
42
|
+
color: var(--color-primary);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- **Syntax suggestions**: Completes Master CSS utilities, values, selectors, queries, and directive syntax in configured languages.
|
|
49
|
+
- **Hover inspection**: Shows generated CSS previews for Master CSS syntax at the cursor.
|
|
50
|
+
- **Syntax highlighting**: Highlights CSS directive syntax with the bundled TextMate grammar, then uses semantic tokens for embedded class lists, token-backed values, selectors, pseudo states, queries, units, important markers, and quoted strings.
|
|
51
|
+
- **Embedded highlighting modes**: Highlights the active class context by default, can highlight every discovered embedded utility, or can disable embedded utility highlighting.
|
|
52
|
+
- **Color support**: Shows VS Code color decorators for supported Master CSS color syntax and lets the VS Code color picker edit those values.
|
|
53
|
+
- **Directive diagnostics**: Reports Master CSS directive errors in CSS, SCSS, LESS, and style blocks inside Vue, Svelte, and Astro files.
|
|
54
|
+
- **Manifest diagnostics**: Reports project manifest loading errors without taking over ESLint class policy warnings.
|
|
55
|
+
- **Directive formatting**: Formats Master CSS directives and keeps class important markers attached, such as `(background-color:transparent) !` to `(background-color:transparent)!`.
|
|
56
|
+
- **Workspace-aware manifests**: Loads project manifests from the closest detected Master CSS workspace so completions and tokens reflect project tokens, utility recipes, mixins, and named conditions.
|
|
57
|
+
- **Restart command**: Provides `Master CSS: Restart Language Server` for reloading the language server after dependency, manifest, or workspace changes.
|
|
58
|
+
|
|
59
|
+
The default language list covers HTML, PHP, JavaScript, TypeScript, JSX, TSX, CSS, SCSS, LESS, Vue, Svelte, Rust, Astro, Markdown, and MDX.
|
|
60
|
+
|
|
61
|
+
For CSS, SCSS, and LESS document formatting, the extension delegates to VS Code's existing formatter first, then repairs Master CSS directive spacing and class-list important markers on the formatted text. Vue, Svelte, and Astro CSS-family `<style>` blocks can be formatted when Master CSS is explicitly selected as the formatter, but the extension does not take over their default formatters automatically.
|
|
62
|
+
|
|
63
|
+
## Workspace Discovery
|
|
64
|
+
|
|
65
|
+
`masterCSS.workspaces` defaults to `auto`. In auto mode, the language server always creates a root workspace and also detects:
|
|
66
|
+
|
|
67
|
+
- CSS files importing `@master/css`
|
|
68
|
+
- `package.json` files that declare Master CSS package dependencies such as `@master/css`, `@master/css-runtime`, or official integration packages matching `@master/css*`
|
|
69
|
+
|
|
70
|
+
Each detected workspace gets its own language service and project manifest. In monorepos, this lets each package use its nearest Master CSS manifest while still keeping the root workspace available.
|
|
71
|
+
|
|
72
|
+
Use explicit workspace globs when auto detection is not the intended project shape:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"masterCSS.workspaces": [
|
|
77
|
+
"apps/admin",
|
|
78
|
+
"apps/shop",
|
|
79
|
+
"packages/design-system"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Settings
|
|
85
|
+
|
|
86
|
+
Set options in `.vscode/settings.json` or VS Code user settings with the `masterCSS.` prefix.
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"masterCSS.suggestSyntax": true,
|
|
91
|
+
"masterCSS.formatDirectives": true,
|
|
92
|
+
"masterCSS.embeddedSyntaxHighlighting": "active"
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
| Setting | Type and default | Description |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| `masterCSS.includedLanguages` | `string[]`, default supported language list | Language IDs that receive Master CSS language features. |
|
|
99
|
+
| `masterCSS.exclude` | `string[]`, default `["**/.git/**", "**/node_modules/**", "**/.hg/**"]` | Glob patterns excluded from all Master CSS language-service features. |
|
|
100
|
+
| `masterCSS.classAttributes` | `string[]`, default `["class", "className"]` | Markup attributes whose quoted string values are treated as Master CSS class strings. |
|
|
101
|
+
| `masterCSS.classAttributeBindings` | `Record<string, [string, string] \| false>`, see defaults below | Bound markup attributes and their wrapping delimiters for framework binding syntax. Set an entry to `false` to disable that binding form. |
|
|
102
|
+
| `masterCSS.classDeclarations` | `string[]`, default `[]` | Variable declarations or object properties whose strings are treated as Master CSS class strings. |
|
|
103
|
+
| `masterCSS.classFunctions` | `string[]`, see defaults below | Function, tagged template, or method-call patterns whose string arguments are treated as Master CSS class strings. |
|
|
104
|
+
| `masterCSS.suggestSyntax` | `boolean`, default `true` | Enables Master CSS completion items. |
|
|
105
|
+
| `masterCSS.inspectSyntax` | `boolean`, default `true` | Enables hover inspection and generated CSS previews. |
|
|
106
|
+
| `masterCSS.renderSyntaxColors` | `boolean`, default `true` | Enables color information for Master CSS syntax. |
|
|
107
|
+
| `masterCSS.formatDirectives` | `boolean`, default `true` | Enables Master CSS directive formatting in CSS-family documents. |
|
|
108
|
+
| `masterCSS.embeddedSyntaxHighlighting` | `"active"`, `"always"`, or `"off"`; default `"active"` | Controls semantic highlighting for embedded utilities in markup and scripts. CSS directive syntax is still highlighted by the TextMate grammar. |
|
|
109
|
+
| `masterCSS.workspaces` | `"auto"` or `string[]`, default `"auto"` | Configures Master CSS workspaces. Auto mode detects CSS entries and Master CSS package dependencies. |
|
|
110
|
+
|
|
111
|
+
Default class binding and function detection:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"masterCSS.classAttributeBindings": {
|
|
116
|
+
"className": ["{", "}"],
|
|
117
|
+
"class": ["{", "}"],
|
|
118
|
+
"class:list": ["{", "}"],
|
|
119
|
+
":class": ["\"", "\""],
|
|
120
|
+
"v-bind:class": ["\"", "\""],
|
|
121
|
+
"[class]": ["\"", "\""],
|
|
122
|
+
"[className]": ["\"", "\""],
|
|
123
|
+
"[ngClass]": ["\"", "\""]
|
|
124
|
+
},
|
|
125
|
+
"masterCSS.classFunctions": [
|
|
126
|
+
"clsx",
|
|
127
|
+
"cva",
|
|
128
|
+
"ctl",
|
|
129
|
+
"cv",
|
|
130
|
+
"class",
|
|
131
|
+
"classnames",
|
|
132
|
+
"classVariant",
|
|
133
|
+
"styled(?:\\s+)?(?:\\.\\w+)?",
|
|
134
|
+
"classList(?:\\s+)?\\.(?:add|remove|toggle|replace)"
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Common Customizations
|
|
140
|
+
|
|
141
|
+
Add a custom language ID:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"masterCSS.includedLanguages": [
|
|
146
|
+
"html",
|
|
147
|
+
"typescriptreact",
|
|
148
|
+
"vue",
|
|
149
|
+
"astro",
|
|
150
|
+
"edge"
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Recognize project-specific class containers:
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"masterCSS.classAttributes": [
|
|
160
|
+
"class",
|
|
161
|
+
"className",
|
|
162
|
+
"ui"
|
|
163
|
+
],
|
|
164
|
+
"masterCSS.classDeclarations": [
|
|
165
|
+
"classes",
|
|
166
|
+
"styles"
|
|
167
|
+
],
|
|
168
|
+
"masterCSS.classFunctions": [
|
|
169
|
+
"clsx",
|
|
170
|
+
"cva",
|
|
171
|
+
"tw",
|
|
172
|
+
"cn"
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Exclude generated or vendored files:
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"masterCSS.exclude": [
|
|
182
|
+
"**/.git/**",
|
|
183
|
+
"**/node_modules/**",
|
|
184
|
+
"**/.hg/**",
|
|
185
|
+
"**/dist/**",
|
|
186
|
+
"**/.next/**"
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Choose embedded highlighting behavior:
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"masterCSS.embeddedSyntaxHighlighting": "always"
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Use `active` for lower-noise active-context highlighting, `always` to highlight all discovered embedded utility classes, and `off` to disable embedded utility highlighting. Master CSS syntax inside CSS, SCSS, and LESS documents remains highlighted by the extension.
|
|
200
|
+
|
|
201
|
+
Disable directive formatting when another formatter integration must own all directive whitespace:
|
|
202
|
+
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"masterCSS.formatDirectives": false
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Commands
|
|
210
|
+
|
|
211
|
+
Open the Command Palette and run:
|
|
212
|
+
|
|
213
|
+
```txt
|
|
214
|
+
Master CSS: Restart Language Server
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Use this after changing dependencies, workspace layout, or project manifest files if VS Code has not reloaded the language server automatically. The extension also restarts the Master CSS language server when `masterCSS.*` settings change.
|
|
218
|
+
|
|
219
|
+
## Requirements and Limitations
|
|
220
|
+
|
|
221
|
+
- Requires VS Code `1.123.0` or newer.
|
|
222
|
+
- Native packages cover macOS x64/ARM64, Windows x64/ARM64, Linux glibc x64/ARM64, and Alpine musl x64/ARM64. The Alpine artifacts are for compatible remote extension hosts; VS Code Desktop itself is not an Alpine application. A packaged artifact alone does not establish compatibility with every downstream editor or remote host.
|
|
223
|
+
- Linux ARM32 (`linux-armhf`) and Universal VSIX files are not provided. Install only the package matching a supported architecture.
|
|
224
|
+
- Requires a trusted local workspace because the language server loads configuration and code from the workspace.
|
|
225
|
+
- Does not support VS Code virtual workspaces or untrusted workspaces.
|
|
226
|
+
- Uses a TextMate injection grammar for CSS directive syntax and semantic tokens for Master CSS class-list spans. It does not contribute a custom `.mcss` language.
|
|
227
|
+
|
|
228
|
+
Keep only one Master CSS language extension enabled to avoid competing language servers. See the [maintainer release notes](https://github.com/master-co/css/blob/rc/packages/vscode/RELEASE.md).
|
|
229
|
+
|
|
230
|
+
## Troubleshooting
|
|
231
|
+
|
|
232
|
+
- **Completions do not show inside strings**: Enable `editor.quickSuggestions.strings` as shown in [Quick Start](#quick-start).
|
|
233
|
+
- **Project tokens or utility completions are missing**: Ensure the project has a detected CSS entry or Master CSS package dependency, then run `Master CSS: Restart Language Server`.
|
|
234
|
+
- **The wrong monorepo package is used**: Set `masterCSS.workspaces` to explicit workspace directories.
|
|
235
|
+
- **Embedded markup highlighting is too noisy or too quiet**: Change `masterCSS.embeddedSyntaxHighlighting` to `active`, `always`, or `off`.
|
|
236
|
+
- **Semantic colors do not appear**: Confirm VS Code semantic highlighting is enabled for the active theme.
|
|
237
|
+
|
|
238
|
+
## Documentation
|
|
239
|
+
|
|
240
|
+
See the [language service guide](https://css.master.co/guide/language-service), the [`@master/css-language-service`](../language-service) README, and the [`@master/css-language-server`](../language-server) README for deeper details.
|
|
241
|
+
|
|
242
|
+
## Community
|
|
243
|
+
|
|
244
|
+
- [Documentation](https://css.master.co/guide/language-service) — Start with setup, features, and troubleshooting.
|
|
245
|
+
- [GitHub Discussions](https://github.com/master-co/css/discussions) — Ask usage questions and share ideas in English or Chinese.
|
|
246
|
+
- [GitHub Issues](https://github.com/master-co/css/issues) — Report reproducible bugs with your editor, extension version, and project setup.
|
|
247
|
+
|
|
248
|
+
[Discord](https://discord.com/invite/sZNKpAAAw6) remains available for informal community chat. Official support requests belong in GitHub Discussions or Issues; Discord has no guaranteed maintainer response.
|
|
249
|
+
|
|
250
|
+
<sub>Our [《 Code of Conduct 》](https://github.com/master-co/css/blob/rc/.github/CODE_OF_CONDUCT.md) applies to all Master CSS community channels.</sub>
|
|
251
|
+
|
|
252
|
+
## Contributing
|
|
253
|
+
|
|
254
|
+
Please see our [CONTRIBUTING](https://github.com/master-co/css/blob/rc/.github/CONTRIBUTING.md) for workflow.
|