Skip to content

Commit

Permalink
fix: OffsetPositionConverter for emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
seven332 committed Nov 12, 2023
1 parent 78900c7 commit 53af1c0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions integration-test/diagnostics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ suite('Diagnostics', () => {
},
])
})

test('error diagnostics', async () => {
await testDiagnostics('error.sksl', [
{
message: "'main' must return: 'vec4', 'float4', or 'half4'",
range: toRange(3, 0, 3, 11),
severity: vscode.DiagnosticSeverity.Error,
},
])
})
})

async function testDiagnostics(name: string, expected: vscode.Diagnostic[]) {
Expand Down
4 changes: 4 additions & 0 deletions integration-test/fixtures/error.sksl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// kind=shader
// 中文
// 😋😋
void main() {}
3 changes: 2 additions & 1 deletion src/offset-position-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export class OffsetPositionConverter {

let index = 0
let prev = ' '
for (const c of content) {
for (let i = 0; i < content.length; ++i) {
const c = content.charAt(i)
switch (c) {
case '\n':
if (prev == '\n') {
Expand Down

0 comments on commit 53af1c0

Please sign in to comment.