DanielXMoore / Civet

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

LSP -- exclude JS files from analysis #1086

Open bbrk24 opened 8 months ago

bbrk24 commented 8 months ago

If I have two files with the same base name, but one is .civet and the other is .js, the LSP ignores the .js file for analysis. However, in my project, I have a couple files where the compiled output is a different name entirely to the source (e.g. worker.civet compiles to pre.js), and the LSP complains about this, even if I add it to the exclude in my tsconfig:

image

etherealHero commented 3 months ago

I’m also interested in this problem, since I can’t configure react native to work with civet in any way. I think it would be convenient to add an additional "destination" or "output" option to the local .civet file configuration. This would help for the civet compiler itself and for civet lsp. For example:

// index.civet
{isAutoVar} from './lorem.js'

isAutoLet = 10

console.log isAutoVar
console.log isAutoLet
// dep.civet
"civet autoVar destination=./lorem.js" // new option for civet LSP and civet compiler

isAutoVar = 10

export isAutoVar

js file after build with civetVitePlugin:

var isAutoVar = 10; // from lorem.js
let isAutoLet = 10;
console.log(isAutoVar);
console.log(isAutoLet);

Only now I realized that the local configuration is ignored if the configuration is defined at the project level civet.config.json. Then it would be a good idea for the local configuration to have higher priority over the global one.

// civet.config.json override local config autoVar
{
  "parseOptions": {
    "autoLet": true
  }
}