purefunctor / purefunctor/purescript-iris-vscode

Migrate language server startup to JSON configuration

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3
Forks
0
Avg merge
7h 33m
Merged PRs (30d)
4

Description

Problem

Compiler PR https://github.com/purefunctor/purescript-alexandrite/pull/496 implements purefunctor's chosen direction for https://github.com/purefunctor/purescript-alexandrite/issues/487: replace --source-command and --diagnostics-on-open/save/change with mutually exclusive --config <JSON> and --config-file <PATH> startup options.

The extension currently constructs ['--source-command', resolvedConfig.sourceCommand] in src/extension.ts. That invocation will be rejected by the updated compiler when a custom source command is configured.

src/configuration.ts and package.json currently expose alexandrite.sourceCommand and the deprecated purescriptAnalyzer.sourceCommand alias. The extension has no diagnostic-trigger settings and relies on compiler defaults.

Compiler contract

The JSON contract already lives in the compiler's shared configuration crate and schema:
https://github.com/purefunctor/purescript-alexandrite/blob/main/compiler-lsp/configuration/configuration.schema.json

Defaults:

{
  "sources": { "kind": "spago" },
  "diagnostics": { "onOpen": true, "onSave": true, "onChange": false }
}

Custom discovery:

{
  "sources": {
    "kind": "command",
    "program": "spago",
    "arguments": ["sources"]
  }
}
  • Missing or null fields retain defaults; {} and top-level null select defaults.
  • Commands supply a nonempty executable and an optional array of individual arguments, without shell parsing.
  • Configuration is read once before startup. Relative --config-file paths resolve from the server process working directory.
  • Unknown fields (including an embedded $schema property), malformed settings, and file-read failures produce stderr errors and exit status 2.
  • This change does not add configuration-file watching or runtime LSP configuration updates; applying changed startup settings still requires a restart.

Requested follow-up

  • Update server argument construction to use the new JSON CLI transport, passing an inline JSON document as a single argument or a configuration file path. Do not emit removed flags for updated compiler versions.
  • Choose and document the extension settings interface, including migration of existing sourceCommand settings and the deprecated alias. Represent executable/argv separately rather than guessing shell quoting by splitting an old command string.
  • Preserve default Spago discovery and diagnostic behavior when settings are absent. Use the shared schema for any exposed diagnostic settings.
  • Define compatibility behavior for older compiler versions explicitly, including actionable migration/error messages.
  • Add tests for generated server arguments, default settings, the selected migration behavior, arguments containing spaces/empty strings, and configuration errors. Update extension settings descriptions and usage documentation.

Compiler implementation thread: https://ampcode.com/threads/T-01a089ad-03d0-70ff-8777-7b90149d0a66

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with server argument construction in src/extension.ts, then read src/configuration.ts, package.json, and the compiler configuration schema linked in the issue. Trace the existing defaults and sourceCommand alias before deciding the settings and compatibility behavior. Done means the new startup transport, migration, argument edge cases, configuration errors, documentation, and related tests are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.