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

RST language support #117

Closed
ghost opened this Issue Nov 18, 2015 · 19 comments

Comments

Projects
None yet
5 participants
@ghost
Copy link

ghost commented Nov 18, 2015

I'd love to see support for ReStructuredText ( http://docutils.sourceforge.net/docs/user/rst/quickref.html ) as it would make one of my current projects a lot simpler. It's similar but not identical to Markdown.

@bpasero

This comment has been minimized.

Copy link
Member

bpasero commented Nov 19, 2015

@Firehawke how about an extension for this :)

@lextm

This comment has been minimized.

Copy link

lextm commented Nov 23, 2015

@bpasero I'd like to work on such an extension, but is there any guidance?

For example, I think I might get started from the markdown language support. Will it be enough to follow these?

@bpasero

This comment has been minimized.

Copy link
Member

bpasero commented Nov 23, 2015

@lextm

This comment has been minimized.

Copy link

lextm commented Nov 23, 2015

@bpasero Thanks. Will spend some time on that.

A few tasks before attacking on,

  • port TextMate syntax highlighting files to VS Code
  • follow Microsoft's materials (doc+sample) to learn the extension model
  • pack up the extension and test it out
  • publish the extension

Finish the above quick tasks, and we should have a basic reST extension running in VS Code.

To move on to build full language support just like Markdown, the tasks become more challenging,

  • build a language server following this guide
  • write the glue code to talk to the language server
  • enable preview (0.0.7+)

To build the language server, there seem to be a few options but it takes a while to be familiar with them.

@bpasero

This comment has been minimized.

Copy link
Member

bpasero commented Nov 23, 2015

Just so that you know: It is currently not possible to open a preview in HTML from an extension like it is possible for markdown.

@lextm

This comment has been minimized.

Copy link

lextm commented Nov 23, 2015

@bpasero Thanks for the tip. I glanced at the markdown language support and found that,

  1. It happens to be based on an open source Markdown parser in JavaScript.
  2. The glue code not only links that parser to VS Code, but also makes the preview work.

It would be difficult to find a reStructuredText parser in JavaScript right now. Existing ones rely on either Python or JVM.

Probably I will refer to languages such as PowerShell or Python to provide syntax highlighting first.

@lextm

This comment has been minimized.

Copy link

lextm commented Nov 24, 2015

Finished some reading on this article and also found TextMate reST syntax highlighting support files. So I think I will revise the task list accordingly.

@lextm

This comment has been minimized.

Copy link

lextm commented Nov 24, 2015

I just published 0.0.1 on the gallery, which implements the very basic feature set,

https://marketplace.visualstudio.com/items/lextudio.restructuredtext

The code and config files are hosted at,

https://github.com/lextm/vscode-restructuredtext

@lextm

This comment has been minimized.

Copy link

lextm commented Nov 26, 2015

@bpasero @egamma I think we can close this now. I created such an extension and published its 0.0.2 version a few hours ago. Syntax highlighting and code snippets have been supported. @Firehawke you can try it out.

@egamma

This comment has been minimized.

Copy link
Member

egamma commented Nov 26, 2015

👏 thank you

@egamma egamma closed this Nov 26, 2015

@ghost

This comment has been minimized.

Copy link
Author

ghost commented Nov 27, 2015

Thank you, by the way. Work blocked me from replying until now, but this is definitely a good start and it looks like it'll be better than using Notepad++. Now I just need to work out a way to quick compile this through Sphinx+RTD, but that's a subject for a different thread.

@lextm

This comment has been minimized.

@egamma

This comment has been minimized.

Copy link
Member

egamma commented Nov 27, 2015

@Firehawke regarding 'Now I just need to work out a way to quick compile this through Sphinx+RTD'. I suggest that you look into the VS Code Task support https://code.visualstudio.com/docs/editor/tasks

@pgerell

This comment has been minimized.

Copy link

pgerell commented Dec 4, 2015

@lextm Thank You. Just what I was looking for.
I am having problems with the section header snippets. Do they work for anyone else?
According to https://code.visualstudio.com/docs/customization/userdefinedsnippets regex replacements are not supported (yet).

Maybe a command that underlines the current line could be used instead. If the line is already a header, it could be modified to use the next header level. This is how the emacs rest-mode works.

@lextm

This comment has been minimized.

Copy link

lextm commented Dec 29, 2015

@pgerell Can you open a new issue at https://github.com/lextm/vscode-restructuredtext so that I can better track it?

I am still digging into VS Code documentation to see how to further improve ReST support, so progress might be slow.

@lextm

This comment has been minimized.

Copy link

lextm commented Apr 4, 2016

The repo has been moved to https://github.com/vscode-restructuredtext/vscode-restructuredtext and preview feature has been added since 0.0.7.

@lextm

This comment has been minimized.

Copy link

lextm commented Jul 8, 2016

True sphinx-build enabled live preview is now available in 0.0.14+,

https://marketplace.visualstudio.com/items?itemName=lextudio.restructuredtext

@mountgellert

This comment has been minimized.

Copy link

mountgellert commented Jan 11, 2017

@lextm , you can try looking at https://www.npmjs.com/package/restructured and try doing a javascript based renderer. Won't be the same fidelity as sphinx, but would be considerably faster.

@lextm

This comment has been minimized.

Copy link

lextm commented Jan 12, 2017

Thanks @mountgellert I will evaluate it but the design goal of vscode-restructuredtext is to show the actual sphinx output (no matter how slow it is). This JS library however can help me improve intellisense.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.