Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't show html tag completion with namespace component #2685

Merged
merged 1 commit into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/language-server/src/lib/documents/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,14 @@ export function updateRelativeImport(oldPath: string, newPath: string, relativeI
*/
export function getNodeIfIsInComponentStartTag(
html: HTMLDocument,
document: Document,
offset: number
): Node | undefined {
const node = html.findNodeAt(offset);
if (
!!node.tag &&
node.tag[0] === node.tag[0].toUpperCase() &&
(node.tag[0] === node.tag[0].toUpperCase() ||
(document.isSvelte5 && node.tag.includes('.'))) &&
(!node.startTagEnd || offset < node.startTagEnd)
) {
return node;
Expand Down
2 changes: 1 addition & 1 deletion packages/language-server/src/plugins/html/HTMLPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class HTMLPlugin
}

private isInComponentTag(html: HTMLDocument, document: Document, position: Position) {
return !!getNodeIfIsInComponentStartTag(html, document.offsetAt(position));
return !!getNodeIfIsInComponentStartTag(html, document, document.offsetAt(position));
}

private getLangCompletions(completions: CompletionItem[]): CompletionItem[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function getComponentAtPosition(
return null;
}

const node = getNodeIfIsInComponentStartTag(doc.html, doc.offsetAt(originalPosition));
const node = getNodeIfIsInComponentStartTag(doc.html, doc, doc.offsetAt(originalPosition));
if (!node) {
return null;
}
Expand Down Expand Up @@ -80,7 +80,7 @@ export function isComponentAtPosition(
return false;
}

return !!getNodeIfIsInComponentStartTag(doc.html, doc.offsetAt(originalPosition));
return !!getNodeIfIsInComponentStartTag(doc.html, doc, doc.offsetAt(originalPosition));
}

export const IGNORE_START_COMMENT = '/*Ωignore_startΩ*/';
Expand Down
Loading