Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Configuration read from top-level exportPdf instead of from typst-lsp.exportPdf #507

Open
kotatsuyaki opened this issue Jun 17, 2024 · 0 comments

Comments

@kotatsuyaki
Copy link

kotatsuyaki commented Jun 17, 2024

  • Component:

    • LSP (used with Emacs with Eglot)
  • LSP version: 0.13.0 from Nixpkgs

  • OS version and name: NixOS unstable

  • I am on the latest stable version of the extension/LSP.

  • I have searched the issues of this repo and believe that this is not a duplicate.

Issue

On Emacs with the Eglot LSP client (after applying a workaround for #434), I configured typst-lsp to export onType with the following .dir-locals.el, but typst-lsp keeps exporting on save instead of on type:

;; The non-working configuration.
((nil
  . ((eglot-workspace-configuration
      . (:typst-lsp (:exportPdf "onType"))))))

The above configuration for Eglot translates to the following call to didChangeConfiguration:

// The non-working call.
{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"typst-lsp":{"exportPdf":"onType"}}}}

I read the code, and it seems like this line in lsp.rs calls config.update_by_map(&values) where values corresponds to {"typst-lsp":{"exportPdf":"onType"}} in the above JSON. However, in this line in config.rs it accesses the map with the key "exportPdf", instead of with "typst-lsp" first and then "exportPdf".

I modified my configuration to have the "exportPdf" key at the root, instead of under "typst-lsp", and it worked:

;; The working (but wrong) configuration.
((nil
  . ((eglot-workspace-configuration
      . (:exportPdf "onType")))))

The above working config translates to:

// The working (but wrong) call.
{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"exportPdf":"onType"}}}

I believe that this is a bug, as the configurations should be under the key "typst-lsp".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant