Skip to content

Commit 4981563

Browse files
Add basic media query auto complete support (#443)
* Add basic media query auto complete support * build * Status support * Add `: ` and trigger suggestion * Add test * Only suggest value if not on feature name * Add schema * MediaQuery is not a BodyDeclaration --------- Co-authored-by: Martin Aeschlimann <martinae@microsoft.com>
1 parent e8be320 commit 4981563

5 files changed

Lines changed: 1803 additions & 128 deletions

File tree

docs/customData.schema.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,38 @@
3737
"description": "Description shown in completion and hover"
3838
}
3939
}
40+
},
41+
"descriptor": {
42+
"type": "object",
43+
"required": ["name"],
44+
"properties": {
45+
"name": {
46+
"type": "string",
47+
"description": "The name of the descriptor."
48+
},
49+
"description": {
50+
"description": "Description of at descriptor shown in completion and hover",
51+
"anyOf": [
52+
{
53+
"type": "string"
54+
},
55+
{ "$ref": "#/definitions/markupDescription" }
56+
]
57+
},
58+
"status": {
59+
"$ref": "#/properties/properties/items/properties/status"
60+
},
61+
"browsers": {
62+
"$ref": "#/properties/properties/items/properties/browsers"
63+
},
64+
"references": {
65+
"type": "array",
66+
"description": "A list of references for the descriptor shown in completion and hover",
67+
"items": {
68+
"$ref": "#/definitions/references"
69+
}
70+
}
71+
}
4072
}
4173
},
4274
"properties": {
@@ -168,6 +200,13 @@
168200
"items": {
169201
"$ref": "#/definitions/references"
170202
}
203+
},
204+
"descriptors": {
205+
"type": "array",
206+
"description": "A list of descriptors for the at-directive, for example prefers-reduced-motion for @media",
207+
"items": {
208+
"$ref": "#/definitions/descriptor"
209+
}
171210
}
172211
}
173212
}

src/cssLanguageTypes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,25 @@ export interface IPropertyData {
198198
relevance?: number;
199199
atRule?: string;
200200
}
201+
export interface IDescriptorData {
202+
name: string,
203+
description?: string,
204+
references?: IReference[],
205+
syntax?: string,
206+
type?: string,
207+
values?: IValueData[]
208+
browsers?: string[];
209+
baseline?: BaselineStatus;
210+
status?: EntryStatus;
211+
}
201212
export interface IAtDirectiveData {
202213
name: string;
203214
description?: string | MarkupContent;
204215
browsers?: string[];
205216
baseline?: BaselineStatus;
206217
status?: EntryStatus;
207218
references?: IReference[];
219+
descriptors?: IDescriptorData[];
208220
}
209221
export interface IPseudoClassData {
210222
name: string;

0 commit comments

Comments
 (0)