Skip to content

LSP does not detect files with <script lang="ts"> and specific RegEX patterns as TypeScript components #68

Description

@CosmoMyzrailGorynych

LSP doesn't accept TypeScript in specific files.
Image

I haven't found anything interesting in LSP logs, and my Svelte configuration is a default one except for the TypeScript preprocessor. svelte-check with --tsconfig shows no errors and my app builds just fine, so it's the LSP doing something weird and not me.

I removed this and that and determined that this short component reproduces the issue:

<main>{String(q).replace(/(ssh|git):\/\//, 'https://')}</main>
<script lang="ts">
    let q: number = $state(1);
</script>
Image

Specifically the regex causes LSP to treat the file as a JS component.
Tokenization also seems to be incorrect here:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions