@shopify/theme-language-server-common
Advanced tools
Comparing version 1.4.3 to 1.4.4
# @shopify/theme-language-server-common | ||
## 1.4.4 | ||
### Patch Changes | ||
- aa33c5f: Fix hover, completion and `UndefinedObject` reporting of `{% increment var %}` and `{% decrement var %}` | ||
- Updated dependencies [0d71145] | ||
- Updated dependencies [aa33c5f] | ||
- Updated dependencies [0d71145] | ||
- @shopify/liquid-html-parser@1.1.0 | ||
- @shopify/theme-check-common@1.18.1 | ||
## 1.4.3 | ||
@@ -4,0 +15,0 @@ |
@@ -121,2 +121,5 @@ "use strict"; | ||
['{% layout non█ %}', 'none'], | ||
['{% increment var %}{{ var█ }}', 'var'], | ||
['{% decrement var %}{{ var█ }}', 'var'], | ||
['{% assign var = 1 %}{{ var█ }}', 'var'], | ||
]; | ||
@@ -123,0 +126,0 @@ for (const [context, expected] of contexts) { |
@@ -128,2 +128,10 @@ "use strict"; | ||
}); | ||
(0, vitest_1.it)('should support {% increment var %}', async () => { | ||
await (0, vitest_1.expect)(provider).to.hover(`{% increment var█ %}`, vitest_1.expect.stringMatching(/##* var: `number`/)); | ||
await (0, vitest_1.expect)(provider).to.hover('{{ var█ }}', null); | ||
}); | ||
(0, vitest_1.it)('should support {% decrement var %}', async () => { | ||
await (0, vitest_1.expect)(provider).to.hover(`{% decrement var█ %}`, vitest_1.expect.stringMatching(/##* var: `number`/)); | ||
await (0, vitest_1.expect)(provider).to.hover('{{ var█ }}', null); | ||
}); | ||
(0, vitest_1.it)('should support contextual objects by relative path', async () => { | ||
@@ -130,0 +138,0 @@ const contexts = [ |
@@ -178,2 +178,11 @@ "use strict"; | ||
} | ||
else if (isLiquidTagIncrement(node) || isLiquidTagDecrement(node)) { | ||
if (node.markup.name === null) | ||
return; | ||
return { | ||
identifier: node.markup.name, | ||
type: 'number', | ||
range: [node.position.start], | ||
}; | ||
} | ||
else if (node.name === 'layout') { | ||
@@ -439,2 +448,8 @@ return { | ||
} | ||
function isLiquidTagIncrement(node) { | ||
return node.name === liquid_html_parser_1.NamedTags.increment && typeof node.markup !== 'string'; | ||
} | ||
function isLiquidTagDecrement(node) { | ||
return node.name === liquid_html_parser_1.NamedTags.decrement && typeof node.markup !== 'string'; | ||
} | ||
//# sourceMappingURL=TypeSystem.js.map |
{ | ||
"name": "@shopify/theme-language-server-common", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"main": "dist/index.js", | ||
@@ -25,4 +25,4 @@ "types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@shopify/liquid-html-parser": "^1.0.0", | ||
"@shopify/theme-check-common": "1.18.0", | ||
"@shopify/liquid-html-parser": "^1.1.0", | ||
"@shopify/theme-check-common": "1.18.1", | ||
"@vscode/web-custom-data": "^0.4.6", | ||
@@ -29,0 +29,0 @@ "vscode-languageserver": "^8.0.2", |
@@ -131,2 +131,5 @@ import { describe, beforeEach, it, expect } from 'vitest'; | ||
['{% layout non█ %}', 'none'], | ||
['{% increment var %}{{ var█ }}', 'var'], | ||
['{% decrement var %}{{ var█ }}', 'var'], | ||
['{% assign var = 1 %}{{ var█ }}', 'var'], | ||
]; | ||
@@ -133,0 +136,0 @@ for (const [context, expected] of contexts) { |
@@ -141,2 +141,18 @@ import { describe, beforeEach, it, expect } from 'vitest'; | ||
it('should support {% increment var %}', async () => { | ||
await expect(provider).to.hover( | ||
`{% increment var█ %}`, | ||
expect.stringMatching(/##* var: `number`/), | ||
); | ||
await expect(provider).to.hover('{{ var█ }}', null); | ||
}); | ||
it('should support {% decrement var %}', async () => { | ||
await expect(provider).to.hover( | ||
`{% decrement var█ %}`, | ||
expect.stringMatching(/##* var: `number`/), | ||
); | ||
await expect(provider).to.hover('{{ var█ }}', null); | ||
}); | ||
it('should support contextual objects by relative path', async () => { | ||
@@ -143,0 +159,0 @@ const contexts: [string, string][] = [ |
@@ -6,4 +6,7 @@ import { | ||
LiquidTag, | ||
LiquidTagDecrement, | ||
LiquidTagIncrement, | ||
LiquidVariable, | ||
LiquidVariableLookup, | ||
NamedTags, | ||
NodeTypes, | ||
@@ -307,2 +310,9 @@ } from '@shopify/liquid-html-parser'; | ||
}; | ||
} else if (isLiquidTagIncrement(node) || isLiquidTagDecrement(node)) { | ||
if (node.markup.name === null) return; | ||
return { | ||
identifier: node.markup.name, | ||
type: 'number', | ||
range: [node.position.start], | ||
}; | ||
} else if (node.name === 'layout') { | ||
@@ -625,1 +635,9 @@ return { | ||
} | ||
function isLiquidTagIncrement(node: LiquidTag): node is LiquidTagIncrement { | ||
return node.name === NamedTags.increment && typeof node.markup !== 'string'; | ||
} | ||
function isLiquidTagDecrement(node: LiquidTag): node is LiquidTagDecrement { | ||
return node.name === NamedTags.decrement && typeof node.markup !== 'string'; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
976290
15205
+ Added@shopify/theme-check-common@1.18.1(transitive)
- Removed@shopify/theme-check-common@1.18.0(transitive)