usethesource / rascal-language-servers

An LSP server for Rascal which includes an easy-to-use LSP generator for languages implemented in Rascal, and an interactive terminal REPL.
BSD 2-Clause "Simplified" License
10 stars 7 forks source link

Error on save for `rsc` files outside project #410

Closed sungshik closed 1 week ago

sungshik commented 1 month ago

Context:

I'm running second level and opened a few test rsc files outside a proper project folder (no folder is opened in Explorer). When I save, I get the exception below (src and target indeed do not exist).

Exception thrown:

|lib://rascal-core/lang/rascalcore/check/Checker.rsc|:260,14: [
  error(
    "PathConfig `srcs`: |file:///c:/Users/sung-/Desktop/src| does not exist",
    |file:///c:/Users/sung-/Desktop/src|),
  error(
    "PathConfig `resources`: IO(\"Unsupported scheme \\\'target\\\'\")",
    |target:///|)
]

Stacktrace:

    at rascalTModelForLocs(|lib://rascal-core/lang/rascalcore/check/Checker.rsc|(10440,27,<259,26>,<261,5>))
    at check(|lib://rascal-core/lang/rascalcore/check/Checker.rsc|(22694,64,<545,9>,<545,73>))
    at $shell$(|main://$shell$|)
DavyLandman commented 1 month ago

True, this is a variant of #341, vs code plugin makes some assumptions about project setup. The RASCAL.MF checker already checks some, but if thats not there, we should maybe do something better there.

We should:

  1. Warn the user about an unsupported project setup
  2. Think about an better error to report in the checker.
DavyLandman commented 1 week ago

Closing this one, as the detector of project setup should give a better warning for his.