diff --git a/packages/language-server/src/plugins/PluginHost.ts b/packages/language-server/src/plugins/PluginHost.ts index 6ac84c1ba..8a31aff66 100644 --- a/packages/language-server/src/plugins/PluginHost.ts +++ b/packages/language-server/src/plugins/PluginHost.ts @@ -141,7 +141,9 @@ export class PluginHost implements LSProvider, OnWatchFileChanges { return false; } if (label[0] === '"' && label[label.length - 1] === '"') { - if (htmlCompletions.has(label.slice(1, -1))) { + // this will result in a wrong completion regardless, remove the quotes + item.label = item.label.slice(1, -1); + if (htmlCompletions.has(item.label)) { // "aria-label" -> aria-label -> exists in html completions return false; } diff --git a/packages/language-server/src/plugins/typescript/features/SemanticTokensProvider.ts b/packages/language-server/src/plugins/typescript/features/SemanticTokensProvider.ts index 1189eb736..b0f172f49 100644 --- a/packages/language-server/src/plugins/typescript/features/SemanticTokensProvider.ts +++ b/packages/language-server/src/plugins/typescript/features/SemanticTokensProvider.ts @@ -77,7 +77,7 @@ export class SemanticTokensProviderImpl implements SemanticTokensProvider { continue; } - const [line, character, length, start] = originalPosition; + const [line, character, length] = originalPosition; // remove identifiers whose start and end mapped to the same location, // like the svelte2tsx inserted render function, diff --git a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Attribute.ts b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Attribute.ts index cfbc34355..7c4cd4e24 100644 --- a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Attribute.ts +++ b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Attribute.ts @@ -111,7 +111,7 @@ export function handleAttribute( return; } else { let name = - element instanceof Element && attr.value === true + element instanceof Element && parent.type === 'Element' ? transformAttributeCase(attr.name) : attr.name; // surround with quotes because dashes or other invalid property characters could be part of the name diff --git a/packages/svelte2tsx/svelte-jsx.d.ts b/packages/svelte2tsx/svelte-jsx.d.ts index 033bb9f42..fbaf4ce03 100644 --- a/packages/svelte2tsx/svelte-jsx.d.ts +++ b/packages/svelte2tsx/svelte-jsx.d.ts @@ -68,7 +68,10 @@ declare namespace svelteHTML { interface AriaAttributes extends svelte.JSX.AriaAttributes {} // eslint-disable-next-line @typescript-eslint/no-empty-interface - interface HTMLAttributes extends svelte.JSX.HTMLAttributes { + interface HTMLAttributes extends svelte.JSX.HTMLAttributes {} + + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface SVGAttributes extends svelte.JSX.SVGAttributes { 'xlink:actuate'?: string | undefined; 'xlink:arcrole'?: string | undefined; 'xlink:href'?: string | undefined; @@ -83,9 +86,6 @@ declare namespace svelteHTML { 'xmlns:xlink'?: string | undefined; } - // eslint-disable-next-line @typescript-eslint/no-empty-interface - interface SVGAttributes extends svelte.JSX.SVGAttributes {} - // eslint-disable-next-line @typescript-eslint/no-empty-interface interface HTMLProps extends HTMLAttributes {} diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/attribute-element/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/attribute-element/expectedv2.js index fadc425af..ad39acb8d 100644 --- a/packages/svelte2tsx/test/htmlx2jsx/samples/attribute-element/expectedv2.js +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/attribute-element/expectedv2.js @@ -1,3 +1,3 @@ { svelteHTML.createElement("div", {"contenteditable":true,}); } { svelteHTML.createElement("div", { contentEditable,}); } - { svelteHTML.createElement("div", { "contentEditable":contenteditable,}); } \ No newline at end of file + { svelteHTML.createElement("div", { "contenteditable":contenteditable,}); } \ No newline at end of file