DanielXMoore / Civet

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

Sourcemaps are off when used with @propName #1250

Closed CosmoMyzrailGorynych closed 1 month ago

CosmoMyzrailGorynych commented 1 month ago

Hey there! I really love the idea of Civet and would like to add it to my game engine as one of the languages a user can choose to write with (it previously used CoffeeScript and TypeScript, but CoffeeScript support is poor nowadays and it doesn't have an LSP).

Unfortunately sourcemaps are incorrect which makes Hover widgets and diagnostics markers shifted in Civet's VSCode extension, and in my engine with monaco-editor. There are several cases but right now I can only tell about one that can be replicated.

Steps to replicate:

  1. Open VSCode with a Civet extension enabled
  2. Create and save this Civet file:
    function (this: {
    x: number
    }) {
    @x = 32
    @x = 'REDACTED'
    @y = 32
    @twoTablespoonsOfVanillaExtract = 42
    @nyan = 52
    }
  3. Observe that there are four errors:
    • The first one with @x = 'REDACTED' is underlined correctly;
    • The second one with @y underlines not the @y but whitespace and the = sign;
    • The third one underlines the property partially
    • The fourth underlines the @nyan almost correctly.
    • Either start or end of the underlines are off by 5 characters (the length of this.?)
    • Hovering over problematic areas also shows that non-underlined portions show the hover widget for this instead of for a property.

So 1) they are off and 2) for some reason some errors with @whatever are shown correctly. Reordering lines doesn't affect which portions of these lines are underlined.

изображение

I suspect that some more serious problems occur only with autoVar/autoLet (and I do want to make Civet in my engine the more noob-friendly code language). I will investigate more and report if I have something to replicate.

STRd6 commented 1 month ago

Thanks for the report hopefully we can have a fix up soon!