typst-preview.nvim icon indicating copy to clipboard operation
typst-preview.nvim copied to clipboard

Custom Port

Open floaterest opened this issue 1 year ago • 3 comments

Passing --static-file-host 127.0.0.1:0 as arguments to the typst preview binary will start the preview local server on a random port. This PR adds an option to the config that allows a user-specified port instead of a random one.

resolves #33

floaterest avatar May 17 '24 11:05 floaterest

Hello there, thanks for this PR. I'll be happy to merge this PR if you add the port option to README's default config also. And please explain that 0 means any free port. Please also handle the error of when the port is already taken by notifying the user with utils.notify(...).

chomosuke avatar May 19 '24 08:05 chomosuke

Sure, I will work on that

floaterest avatar May 19 '24 13:05 floaterest

Sorry for the delay.

I implemented the error handling and added documention (in README.md and typst-preview.nvim.txt)

floaterest avatar Jul 18 '24 20:07 floaterest

Hi, I have updated the codebase.

It will now detect the "AddrInUse" error from tinymist. To handle the error, the code will attempt to use the next port (e.g. try 8001 instead of 8000).

I have also updated the docs and README.

floaterest avatar Jan 06 '25 23:01 floaterest

Hi, can we maybe not try "port +1" by default or at least have an option to disable it? Instead can we return an error so that user can handle the error by themselves if they prefer.

LEXUGE avatar Feb 01 '25 12:02 LEXUGE

Hi, can we maybe not try "port +1" by default or at least have an option to disable it? Instead can we return an error so that user can handle the error by themselves if they prefer.

@LEXUGE Please open a new issue requesting this. This PR has been there for a while and i'd like to merge it instead of requesting more changes.

chomosuke avatar Feb 03 '25 20:02 chomosuke

And thank you for excellent work :>.

chomosuke avatar Feb 03 '25 20:02 chomosuke