zikaari / rink-languages

MIT License
2 stars 0 forks source link

[Question] How to consume this package ? #1

Closed paul-marechal closed 6 years ago

paul-marechal commented 6 years ago

I was wondering how to use this package.

I couldn't find it on your npm page.

Also, how are you using it from your application ? Are you registering by hand each language or is there an utility function to fetch it ?

I saw this piece in the index.ts but I wonder how it would work in the browser:

            // ...
                getAsJSON: () => fs.readFile(
                    join(packageRuntime.info.installPath, 'grammars/', path),
                    'utf8'
                ),
            // ...
zikaari commented 6 years ago

Rink is a standalone IDE that I'm working on as we speak. It runs in Chrome Devtools shell.

It has filesystem access over WebSocket, courtesy of accompanying nodejs process that runs in background. Likewise, Rink packages/extensions also get access to filesystem and stuff like packageRuntime.info.installPath etc.

This repository might prove to be a gold mine if you can adapt it to fit Theia limitaions/features.

I'm afraid I don't have much knowledge of Theia's architecture, but if I were you, I would only care about scripts/bake_manifest.js and stuff in grammars/*

Once you utilize those two things, the only thing you'll need to worry about is how you can feed those grammars to monaco-textmate.

Questions welcome.

paul-marechal commented 6 years ago

Thank you for your answer !

So basically the goal would be to use your package as a npm dev dependency and rely on the grammars/ folder. The problem I have is that I don't know how to import you package. I would have expected to fetch it from npm but I couldn't find it on npm.

Because there is so much languages that seem supported by your package that it would seem foolish to try to recompose something similar on our side :p

zikaari commented 6 years ago

Hmmmmm......

I see where we are heading. I'm gonna publish monaco-textmate-languages later today which ~should~ will solve issues you're having.

zikaari commented 6 years ago

That will act as a mega repository of text ate grammars. The biggest mankind has ever seen

paul-marechal commented 6 years ago

@epatpol history being written.

zikaari commented 6 years ago

History has been written

NeekSandhu/monaco-textmate-languages

zikaari commented 6 years ago

cc @aeschli

speaking of https://github.com/NeekSandhu/onigasm/pull/12#issuecomment-400216698 , you also might find monaco-textmate-languages useful. That way we can have collectvely maintained one source of truth even when using monaco-textmate with CodeMirror or Ace editor etc.

PS: I'm happy to transfer monaco-textmate-languages over to GitHub/MicroSoft where it can be maintained more responsibly.

paul-marechal commented 6 years ago

Closing because now available on npm :) Thanks again !