DanielXMoore / Civet

A TypeScript superset that favors more types and less typing
https://civet.dev
MIT License
1.33k stars 28 forks source link

Sourcemap fix, show diagnostics with nonfatal parse errors #1272

Closed edemaine closed 1 month ago

edemaine commented 1 month ago

It turns out #1262 introduced a bug in sourcemaps, which caused the VSCode plugin to crash because of negative column numbers. 😦 The key fix in this PR is removing the + here:

-        sm.column += line.length
+        sm.colOffset = line.length

Fixing this restores correct behavior. This is fairly urgent because the VSCode plugin is currently broken if the user installs the latest Civet.

I also added a feature to the LSP / VSCode plugin: if there are nonfatal errors (via Error nodes), so there's still a transpiled document, we still get TypeScript diagnostics. Example:

image