Skip to content

projectResolution cannot be configured in Emacs lsp-mode #2372

@WiredMic

Description

@WiredMic

Is there an existing issue for this?

  • I have searched the existing issues

Platform

Other Platforms (universal)

Editor

Emacs

Editor Version

GNU Emacs 30.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.51, cairo version 1.18.4)
and lsp-mode with "7642778d595f0158d17740e40a47646cfecbe96a"

Describe the bug

The Problem

I am trying to use Tinymist on Emacs using https://github.com/emacs-lsp/lsp-mode/blob/master/clients/lsp-typst.el.
I can get it to work. However, when I want to configure Tinymist it does not work.
I set tinymist.projectResolution to "lockDatabase", but Tinymist is still in "singleFile" mode.

My Config

I use Doom emacs and has made a module for it.
[https://github.com/WiredMic/doomemacs/tree/typst/modules/lang/typst](My Doom Emacs typst module).

;;; lang/typst/config.el -*- lexical-binding: t; -*-
;; https://myriad-dreamin.github.io/tinymist/frontend/emacs.html
;; https://github.com/emacs-lsp/lsp-mode/blob/master/clients/lsp-typst.el

(defgroup doom-typst nil
  "Typst language support for Doom Emacs."
  :group 'languages
  :group 'programming)

(defcustom +typst-lsp-server-path nil
  "Path to binary server file."
  :group 'doom-typst
  :risky t
  :type 'file)

(defun +typst-lsp-config ()
  (when (modulep! +lsp)
    (message "Running LSP config")
    (if (modulep! :tools lsp -eglot)

        (progn
          (after! lsp-mode
            (require 'lsp-typst)
            (when +typst-lsp-server-path
              (setq lsp-typst-server-command (list +typst-lsp-server-path)))
            (set-lsp-priority! 'tinymist 0)))

      (after! eglot
        (set-eglot-client! 'typst-ts-mode
                           (lambda (&rest _)
                             (let  ((server-path (or +typst-lsp-server-path "tinymist")))
                               (list server-path))))))))


(use-package! typst-ts-mode
  :when (modulep! +tree-sitter)
  :mode "\\.typ\\'"
  :init
  (set-tree-sitter! nil 'typst-ts-mode
    '((typst :url "https://github.com/uben0/tree-sitter-typst"
       :commit "13863ddcbaa7b68ee6221cea2e3143415e64aea4")))
  :hook (typst-ts-mode . (lambda () (when (modulep! +lsp) (lsp!))))
  :config
  (+typst-lsp-config))
(use-package! typst-ts-mode
  :init
  (setq lsp-typst-project-resolution "lockDatabase"
           lsp-typst-server-command   "tinymist")
  
  (setq-default eglot-workspace-configuration
                '(:tinymist (:projectResolution "lockDatabase")))

  )

My Test Procedure

I made a test repo with all of the files.
https://github.com/WiredMic/test_typst

This repo has two Typst files, a tinymist.lock, and a biblatex file.
first.typ is the main file and second.typ is called from first.typ.
When writing second.typ the label @dirac is not found by Tinymist.

I have captured the logs from lsp-mode.

  1. restart Emacs
  2. open second.typ
  3. copy lsp-log and stderr form lsp-mode

I have also captured the log files form VS Code.
There are no problems in VS Code

  1. restart VS Code
  2. open second.typ
  3. copy Tinymis Typst

Server Logs

lsp-mode's lsp-log

lsp-log.log

lsp-mode stderr

stderr.log

VS Code Tinymist Typst

Tinymist Typst.log

Browser Logs

Paste your logs here

Additional context

repo.zip

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions