Skip to content

Commit

Permalink
Fix mrmlnc#175: add missing enums for the AST node types. To match vs…
Browse files Browse the repository at this point in the history
[email protected] values.

this will fix variables in the `MediaQuery` being recognized as `FunctionParameter` and be ignored.
  • Loading branch information
mbehzad committed Nov 14, 2024
1 parent a2c8446 commit 4b61b2d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions fixtures/e2e/_variables.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
$variable: 'value';
$variable2: min-width 1200px;
2 changes: 2 additions & 0 deletions fixtures/e2e/definition/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
content: $variable + function();

@include mixin();

@media ($variable2) {};
}
6 changes: 6 additions & 0 deletions src/unsafe/test/e2e/suite/definition/definitions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ describe('SCSS Definition Test', () => {
await testDefinition(docUri, position(2, 13), expectedLocation);
});

it('should find definition for variables in media', async () => {
const expectedDocumentUri = getDocUri('_variables.scss');
const expectedLocation = sameLineLocation(expectedDocumentUri, 2, 1, 11);
await testDefinition(docUri, position(6, 12), expectedLocation);
});

it('should find definition for functions', async () => {
const expectedDocumentUri = getDocUri('_functions.scss');
const expectedLocation = sameLineLocation(expectedDocumentUri, 1, 1, 9);
Expand Down
16 changes: 14 additions & 2 deletions src/unsafe/types/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export enum NodeType {
For,
Each,
While,
MixinContent,
MixinContentReference,
MixinContentDeclaration,
Media,
Keyframe,
FontFace,
Expand All @@ -67,7 +68,18 @@ export enum NodeType {
AtApplyRule,
CustomPropertyDeclaration,
CustomPropertySet,
ListEntry
ListEntry,
Supports,
SupportsCondition,
NamespacePrefix,
GridLine,
Plugin,
UnknownAtRule,
Use,
ModuleConfiguration,
Forward,
ForwardVisibility,
Module
}

export interface INode {
Expand Down

0 comments on commit 4b61b2d

Please sign in to comment.