-
Notifications
You must be signed in to change notification settings - Fork 78
Make main file configurable #426
base: master
Are you sure you want to change the base?
Conversation
I commented why
To make Line 180 in 0d5b933
From my simple test, simply creating a uri for main file by Another weird behavior is that if we set a main file in the configuration and open another file, typst-lsp will fail on everything, because it tries to work on the configured main file rather the opening file. Also note that the main file configuration may fail if one is opening a symbol linked file, because the language server host may or may not canonicalize a symbol link (which is likely not defined by the language server protocol). |
@Myriad-Dreamin Can you elaborate what you mean? If I use the typst-lsp of this PR and set [language-server.typst-lsp.config]
mainFile = "file:https:///abs/path/to/project/dir/main.typ"
exportPdf = "onPinnedMainType" in the (helix) LSP config, then opening helix at However, I do note that references only start to be looked up correctly when I actually open the What precisely goes wrong? Having to open the |
Since it is a bit hard to explain, I want to explore it and fix some bugs in this PR for you when I have time. Currently I'm on vacation with my family :). I also leave some notes here for future me and you all. Path Normalizationtypst-lsp doesn't do normalization on paths (URLs) so that:
This blocks us set absolute and especially relative path in the configuration easily. Support both syntactic and semantic completionIf some users pin a file
This prevents people from going through the external files on having set Bad root path when some user pins an absolute pathI noticed that when I set |
@nvarner This should be involved in design of the "SourceManager", to provide a more user friendly configuration to the main file, instead of a url: mainFile = "file:https:///abs/path/to/project/dir/main.typ" |
Very rough fix. Not sure if I will have the time to flesh it out.
See discussion in #366 (comment).