Closed ivansigmund closed 1 month ago
i found it has to do with the same bug as here: https://github.com/zed-industries/zed/issues/18456
i downgraded my zed to 0.155.2 in order to make the build on save working
Probably worth keep this open for visibility if when others try to look up this issue. The underlying issue is a change in expectation from Zed about how certain things are communicated with texlab
(resulting in texlab
no longer being notified on files being saved).
texlab
):Revert to some version of Zed before 0.156.0 (released 9th Oct).
tasks.json
)Alternatively, you can completely bypass texlab
for build and forward/inverse search. This could be done in the terminal (in Zed or external), or via Zed tasks. The benefit of tasks is that they can be given keybinds in Zed.
You could run the build program in the terminal (inside Zed or external). For example running latexmk -pvc
will be suitable for most people, which will build the PDF and rebuild it whenever any relevant files change.
Add a task in .config/zed/tasks.json
(or .zed/tasks.json
in your workspace), to open the PDF with the appropriate arguments to have forward/inverse search working correctly. A benefit of this is that the forward-search is more accurate this way compared to on-save (see this issue).
Here is an example for zathura:
// .zed/tasks.json
[
{
"label": "Forward Search",
"command": "zathura --synctex-forward \"$ZED_ROW:$ZED_COLUMN:$ZED_FILE\" -x 'zed %{input}:%{line}' main.pdf",
"allow_concurrent_runs": true,
"reveal": "never"
}
]
Have a look at this issue for other examples.
The Zed task will be invoked with environment variables $ZED_ROW
, $ZED_COLUMN
, $ZED_FILE
(among others, see docs). These must be used to have the PDF viewer highlight the correct location. Note also that the example assumes that the PDF is called main.pdf
and at the root of the workspace. Adjust this to your situation, a robust solution working out the location of the PDF in general would inevitably be complicated.
Afterwards, this task can be run from the command pallet > spawn task > Forward Search. Or can be given a keybind, for example:
// ~/.config/zed/keymap.json
// ...
{
"context": "Workspace",
"bindings": {
"shift shift": ["task::Spawn", { "task_name": "Forward Search" }]
}
}
]
texlab
to register watched files with Zed. May take some time, and then some extra for the next texlab
release, at which point this extension will download the newer texlab
version.in the end it was decided that the Zed team's interpretation of the LSP spec needed to change.
.fls
file produced with the -recorder
option, and the output of latexmk -dir-report-only
).I am personally unlikely be working much on these over the next two weeks. However for point 2, people could raise issues with suggestions for content to put in the wiki if they have created their own tasks.json
which works well with a their PDF viewer. Bonus points for typing/formatting accompanying text so that it can just be copy-pasted as is into the wiki.
my forward search task in tasks.json with Skim:
[
{
"label": "Forward Search",
"command": "/Applications/Skim.app/Contents/SharedSupport/displayline -r \"$ZED_ROW\" main.pdf \"$ZED_FILE\"",
"allow_concurrent_runs": true,
"reveal": "never"
}
]
Fixed by https://github.com/zed-industries/zed/pull/19183 and all should be fine in the current Zed release. The Zed tasks will however still be experimented with to allow doing these actions on a keybind instead of on save, potentially addressing #29 too.
I was just working on my latex file, and it was working as expected, until there were no more latexmk builds going on automatically on save. now i need to do it manually from terminal. There are no latex errors. here is my setup: