Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode editor support #37

Open
MIracleyin opened this issue Mar 27, 2024 · 7 comments
Open

vscode editor support #37

MIracleyin opened this issue Mar 27, 2024 · 7 comments

Comments

@MIracleyin
Copy link

Hey!

Nice to see this project! I seen texpresso support Emacs and Neovim.
Have any plan to support vscode?

Yin

@let-def
Copy link
Owner

let-def commented Mar 27, 2024

Hello,
I don't have the time nor the knowledge to add support for vscode myself. However I can provide help if someone works on that.
I think the easier would be to integrate with an existing LSP server for LaTeX, see #36

@DominikPeters
Copy link

Hi, I wrote a simple extension: https://marketplace.visualstudio.com/items?itemName=DominikPeters.texpresso-basic / https://github.com/DominikPeters/texpresso-vscode The technically difficult part was translating character offset into byte offsets.

@let-def
Copy link
Owner

let-def commented May 7, 2024

Thank you, that looks very nice. I am not a vscode user myself so I cannot test however.
Do you mind if I put a link to your extension in the README? Or I can wait if you prefer.

@DominikPeters
Copy link

Yes, putting a link sounds good.

@let-def
Copy link
Owner

let-def commented May 7, 2024

I see that you are using a rope data structure for mapping the logical coordinates to byte coordinates, that's a good idea.

I don't know if you have seen, but the protocol also has support for line-indexed changes. That is useful for neovim which have broken byte indices. Would that help with VSCode?
I don't want to discourage you for using rope though, that's totally fine.

@leanhdung1994
Copy link

Hi, I wrote a simple extension: https://marketplace.visualstudio.com/items?itemName=DominikPeters.texpresso-basic / https://github.com/DominikPeters/texpresso-vscode The technically difficult part was translating character offset into byte offsets.

Thank you so much for your contribution! I will check it out.

@DominikPeters
Copy link

Thanks, I tried the lines protocol but couldn't get it to work. VSCode informs the extension about changes by giving a list of changes, each of which is specified by (character offset, character length, replacement text). But if it tells me about several changes in a row, there is no way for me to access the file content in between the changes. However I need that to figure out how many lines are involved by character length and to extend the replacement text to capture the full lines. So I'd still need to keep a copy of the content in a data structure that supports efficient edits and line (instead of byte) lookups. So I went for bytes because my guess was that the overhead for that is lower on the texpresso side.

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

No branches or pull requests

4 participants