nwolverson / purescript-language-server

MIT License
184 stars 41 forks source link

configuring psa's strict flag #107

Closed joprice closed 2 years ago

joprice commented 3 years ago

I can't seem to figure out how to turn warnings into errors. I noticed that https://github.com/natefaubion/purescript-psa#sample-usage ha a strict flag, and this repo has a buildCommand setting, so I tried using them together, spago build --purs-args --json-errors --strict, but that doesn't seems to have any effect.

natefaubion commented 3 years ago

You need to quote them all, or add --purs-args for each one. --purs-args="--json-errors --strict" or --purs-args --json-errors --purs-args --strict.

joprice commented 3 years ago

Ah that makes sense. I tried it, and it works on the first compile with spago if I wipe out the build directory. (Subsequent compiles return no errors). However, if I add the flags to the .vim/coc-settings.json, I still only see warnings.

Here's my coc-settings.json file

{
    "languageserver": {
      "purescript": {
        "command": "purescript-language-server",
        "args": [
          "--stdio"
        ],
        "filetypes": [
          "purescript"
        ],
        "rootPatterns": [
          "psc-package.json",
          "spago.dhall"
        ],
        "settings": {
          "purescript": {
            "addSpagoSources": true,
            "autoStartPscIde": true,
            "pscIdePort": 8898,
            "autocompleteAddImport": true,
            "addNpmPath": true,
            "buildCommand": "spago build --purs-args --json-errors --purs-args --strict"
          }
        }
      }
    },
    "coc.preferences.formatOnSaveFiletypes": [
      "*"
    ]
  }

Also, is there a way to configure these some place where spago and coc-settings.json would pick them up without having to keep them in sync?

joprice commented 3 years ago

I found this one https://github.com/purescript/spago/issues/455 mentioning my second question.

nwolverson commented 3 years ago

Regarding warnings and spago, there are issues around warnings on rebuild (they are not persisted by the compiler), while you can use psa to "stash" warnings, it may be flaky. Regardless, "warnings into errors" is not going to be respected by the rebuild on save functionality, as that does not make use of the build command (and hence psa) - it is just presenting the compiler output directly.

nwolverson commented 2 years ago

I believe this configuration question was answered, please reopen if there was a remaining question