Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Add language in LanguageManager from &str #104

Open
zer0x64 opened this issue Jul 19, 2019 · 5 comments
Open

Add language in LanguageManager from &str #104

zer0x64 opened this issue Jul 19, 2019 · 5 comments

Comments

@zer0x64
Copy link

zer0x64 commented Jul 19, 2019

Right now, the only way to use a custom language for syntax highlighting is to install the .lang file inside specific folders or add a folder that contains it to the search path.
It would be very nice to add the ability to load a custom language syntax from a &str, which would allow to embed the file inside the executable using the include_str!() macro.

@GuillaumeGomez
Copy link
Member

You can't in the C code. Doing it in rust would mean putting this string into a file located into the search path of the LanguageManager, which doesn't seem like a good idea from my point of view...

@zer0x64
Copy link
Author

zer0x64 commented Jul 19, 2019

So this would be a limitation of the underlying C library?
What would be the cleanest way to use a custom syntax file? Right now I'm adding the executable path dynamically to the search path.

@zer0x64
Copy link
Author

zer0x64 commented Jul 19, 2019

Not sure if this was obvious, but that was a feature request, not really a question. I don't know a lot about the code base, but would it be really difficult to implement? If it's not that hard, I can try to do it and open a PR

@GuillaumeGomez
Copy link
Member

If you're talking about adding it in the Rust code base, I can't assure you we'll accept it. We're not big fans of adding specific features to the binding instead of the C library. If it's the C library you're talking about, then it's not the good place. :)

@zer0x64
Copy link
Author

zer0x64 commented Jul 22, 2019

Hi! Just a quick note that, in my specific case, I'll try to get my .lang files accepted directly into the upstream C project, as others could also make use of it.

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

No branches or pull requests

2 participants