sile-typesetter / sile

The SILE Typesetter — Simon’s Improved Layout Engine
https://sile-typesetter.org
MIT License
1.61k stars 97 forks source link

VSCode extension #1406

Open baubleb opened 2 years ago

baubleb commented 2 years ago

Currently many use integrated editor environments for LaTeX, for example TexStudio.

It would be nice to have an extenson for VSCode for syntax highlighting (and other features over time such as document preview, intellisense and snippets) for SILE to make it a better writing experience.

Further information on VSCode extensions, here

Extension API Extension Anatomy Syntax Highlighting Guide Code Completion

alerque commented 2 years ago

I agree there is a need and would be happy to facilitate this. If somebody wants to work on it and gets at least a proof of concept going that does something I'd be happy to host it in the GitHub org here and get whoever is working on it the necessary permissions. That being said I don't use VSCode myself so I likely won't be cooking up an extension on my own—somebody else with the expertise and the itch will have to tackle this.

For my own part I use NeoVIM and hence we already have a vim-sile plugin with full syntax highlighting support.

Not 100% the same issue but as a related side note, the one thing I would like to see a VSCode extension for is for importing the syntax highlighting rules into linguist and others so we can have syntax highlighting here on GitHub for sil sources. For that we also need a threshold number of sil files posted in repos "in the wild". Last I looked we were about half way there. If you have open licensed projects and/or even sandbox testing and experiments that can be posted publicly...

Omikhleia commented 2 years ago

FWIW, I use LaTeX syntax coloring and the LTeX VSCode extension as basic grammar/spell checker. It works "decently" with SIL files, although not perfectly...

(As for document preview, I've no idea but it might be a bit hard when working with included files, no?)

baubleb commented 2 years ago

A SILE Language Server might help here, it then could be used by many writing environments (IDE's) that are language server compatible.

Language Server Protocol Language Server Extension Guide

This would be more widely beneficial for more writing environments.

VSCode is a jack of all trades IDE and widely used. LSP is de facto standardising across writing environments (Neovim also is LSP compatible, see NeoVim LSP)

Preview can simply be a "hit compile often" to see the "output pane" like we do with TexStudio.

The real benefit is suggestion and command completion in the environment. Discovery of commands and scoping of environments.

alerque commented 2 years ago

Yes, an LSP language server for the sile format would be great. In that case some integration with Lua LSPs to expose the SILE API for completion and in-editor documentation would be amazing.

Again I don't expect to be able to work on this soon myself, but would gladly chip in to facilitate it if somebody wants to get started.

colbyn commented 1 year ago

I've been working on my own markup language and the syntax is pretty similar to SILE. For instance it seems like dashes and colons as valid cmd identifiers in SILE.

Unless I'm mistaken?

Anyway if it's useful, here's an example

Screen Shot 2022-09-30 at 10 35 18 PM

Which breaks with LaTeX syntax highlighting

Screen Shot 2022-09-30 at 10 35 30 PM

Anyway it's a pretty basic implementation at the moment, but if it's useful, you can find the vscode implementation over here...

alerque commented 5 months ago

This branch has an EBNF grammar, which might be useful for generating a treesitter parser that would work in VSCode and others for syntax highlighting. Input on how to get tooling spun up derived from this or for fixing mistakes in the grammar would be welcome.