Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ export function isComponentAtPosition(
* because it's purely generated.
*/
export function isInGeneratedCode(text: string, start: number, end: number) {
const lineStart = text.lastIndexOf('\n', start);
const lineEnd = text.indexOf('\n', end);
const lastStart = text.substring(lineStart, start).lastIndexOf('/*Ωignore_startΩ*/');
const lastEnd = text.substring(lineStart, start).lastIndexOf('/*Ωignore_endΩ*/');
return lastStart > lastEnd && text.substring(end, lineEnd).includes('/*Ωignore_endΩ*/');
const lastStart = text.lastIndexOf('/*Ωignore_startΩ*/', start);
const lastEnd = text.lastIndexOf('/*Ωignore_endΩ*/', start);
const nextEnd = text.indexOf('/*Ωignore_endΩ*/', end);
return lastStart > lastEnd && lastStart < nextEnd;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,11 @@ describe('DiagnosticsProvider', () => {
range: {
end: {
character: 13,
line: 3
line: 4
},
start: {
character: 12,
line: 3
line: 4
}
},
severity: 1,
Expand All @@ -825,11 +825,11 @@ describe('DiagnosticsProvider', () => {
range: {
end: {
character: 6,
line: 4
line: 5
},
start: {
character: 5,
line: 4
line: 5
}
},
severity: 1,
Expand All @@ -842,11 +842,11 @@ describe('DiagnosticsProvider', () => {
range: {
end: {
character: 10,
line: 8
line: 9
},
start: {
character: 9,
line: 8
line: 9
}
},
severity: 1,
Expand All @@ -859,11 +859,28 @@ describe('DiagnosticsProvider', () => {
range: {
end: {
character: 10,
line: 9
line: 10
},
start: {
character: 9,
line: 9
line: 10
}
},
severity: 1,
source: 'ts',
tags: []
},
{
code: 2322,
message: 'Type \'"food"\' is not assignable to type \'"foo" | "bar"\'.',
range: {
start: {
character: 2,
line: 15
},
end: {
character: 9,
line: 15
}
},
severity: 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<script lang="ts">
export let variant: "foo" | "bar";
export let style: string;
</script>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import Comp from './diagnostics-ignore-generated-imported.svelte';
</script>

{#if typeof a === 'string'}
Expand All @@ -10,3 +11,11 @@
{b}
{/if}
{/if}

<Comp
variant="food"
style={`${
1
}`}
on:click={() => {}}
/>