@volar/vue-language-core
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -31,2 +31,3 @@ "use strict"; | ||
genericOffset: 0, | ||
attrs: {}, | ||
}; | ||
@@ -33,0 +34,0 @@ scriptSetupRanges = { |
@@ -70,3 +70,3 @@ import { FileCapabilities, VirtualFile, FileKind, FileRangeCapabilities, MirrorBehaviorCapabilities } from '@volar/language-core'; | ||
updateCustomBlocks(blocks: SFCBlock[]): void; | ||
updateBlock<T>(oldBlock: T, newBlock: T): void; | ||
updateBlock<T extends object>(oldBlock: T, newBlock: T): void; | ||
} |
@@ -398,3 +398,3 @@ "use strict"; | ||
name: 'template', | ||
start: this.snapshot.getText(0, block.loc.start.offset).lastIndexOf('<'), | ||
start: this.snapshot.getText(0, block.loc.start.offset).lastIndexOf('<' + block.type), | ||
end: block.loc.end.offset + this.snapshot.getText(block.loc.end.offset, this.snapshot.getLength()).indexOf('>') + 1, | ||
@@ -405,2 +405,3 @@ startTagEnd: block.loc.start.offset, | ||
lang: block.lang ?? 'html', | ||
attrs: block.attrs, | ||
} : null; | ||
@@ -417,3 +418,3 @@ if (this.sfc.template && newData) { | ||
name: 'script', | ||
start: this.snapshot.getText(0, block.loc.start.offset).lastIndexOf('<'), | ||
start: this.snapshot.getText(0, block.loc.start.offset).lastIndexOf('<' + block.type), | ||
end: block.loc.end.offset + this.snapshot.getText(block.loc.end.offset, this.snapshot.getLength()).indexOf('>') + 1, | ||
@@ -426,2 +427,3 @@ startTagEnd: block.loc.start.offset, | ||
srcOffset: block.src ? this.snapshot.getText(0, block.loc.start.offset).lastIndexOf(block.src) - block.loc.start.offset : -1, | ||
attrs: block.attrs, | ||
} : null; | ||
@@ -438,3 +440,3 @@ if (this.sfc.script && newData) { | ||
name: 'scriptSetup', | ||
start: this.snapshot.getText(0, block.loc.start.offset).lastIndexOf('<'), | ||
start: this.snapshot.getText(0, block.loc.start.offset).lastIndexOf('<' + block.type), | ||
end: block.loc.end.offset + this.snapshot.getText(block.loc.end.offset, this.snapshot.getLength()).indexOf('>') + 1, | ||
@@ -447,2 +449,3 @@ startTagEnd: block.loc.start.offset, | ||
genericOffset: typeof block.attrs.generic === 'string' ? this.snapshot.getText(0, block.loc.start.offset).lastIndexOf(block.attrs.generic) - block.loc.start.offset : -1, | ||
attrs: block.attrs, | ||
} : null; | ||
@@ -461,3 +464,3 @@ if (this.sfc.scriptSetup && newData) { | ||
name: 'style_' + i, | ||
start: this.snapshot.getText(0, block.loc.start.offset).lastIndexOf('<'), | ||
start: this.snapshot.getText(0, block.loc.start.offset).lastIndexOf('<' + block.type), | ||
end: block.loc.end.offset + this.snapshot.getText(block.loc.end.offset, this.snapshot.getLength()).indexOf('>') + 1, | ||
@@ -470,2 +473,3 @@ startTagEnd: block.loc.start.offset, | ||
scoped: !!block.scoped, | ||
attrs: block.attrs, | ||
}; | ||
@@ -488,3 +492,3 @@ if (this.sfc.styles.length > i) { | ||
name: 'customBlock_' + i, | ||
start: this.snapshot.getText(0, block.loc.start.offset).lastIndexOf('<'), | ||
start: this.snapshot.getText(0, block.loc.start.offset).lastIndexOf('<' + block.type), | ||
end: block.loc.end.offset + this.snapshot.getText(block.loc.end.offset, this.snapshot.getLength()).indexOf('>') + 1, | ||
@@ -496,2 +500,3 @@ startTagEnd: block.loc.start.offset, | ||
type: block.type, | ||
attrs: block.attrs, | ||
}; | ||
@@ -510,5 +515,15 @@ if (this.sfc.customBlocks.length > i) { | ||
updateBlock(oldBlock, newBlock) { | ||
for (let key in newBlock) { | ||
oldBlock[key] = newBlock[key]; | ||
for (const key in newBlock) { | ||
if (typeof oldBlock[key] === 'object' && typeof newBlock[key] === 'object') { | ||
this.updateBlock(oldBlock[key], newBlock[key]); | ||
} | ||
else { | ||
oldBlock[key] = newBlock[key]; | ||
} | ||
} | ||
for (const key in oldBlock) { | ||
if (!(key in newBlock)) { | ||
delete oldBlock[key]; | ||
} | ||
} | ||
} | ||
@@ -515,0 +530,0 @@ } |
@@ -74,2 +74,3 @@ import * as embedded from '@volar/language-core'; | ||
content: string; | ||
attrs: Record<string, string | true>; | ||
} | ||
@@ -76,0 +77,0 @@ export interface Sfc { |
{ | ||
"name": "@volar/vue-language-core", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"main": "out/index.js", | ||
@@ -29,3 +29,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "927d564d66ba041da4c4affcb9f06d197613aa54" | ||
"gitHead": "e1655186c2f4ce4245279936cb2f4bdbf9f76dec" | ||
} |
Sorry, the diff of this file is too big to display
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
232539
5109