Oni: Flow Language Server?

Created on 24 Aug 2017  路  7Comments  路  Source: onivim/oni

I searched but couldn't find any open issues here. What would be the recommended approach for integrating flow and eslint for javascript support? Maybe I could lend a hand.

enhancement help wanted language-integration question

All 7 comments

Thanks for posting the question, @rrichardson ! This would definitely be useful giving the popularity of flow and eslint.

ESLint

ESLint looks to be pretty similiar to TSLint (which I created a really simple plugin for here: https://github.com/extr0py/oni-plugin-tslint), in that it's a CLI tool that pushes out errors.

I think a good starting point here would be to clone the oni-plugin-tslint repo, and tweak it pick up the ESLint CLI tool. The interesting bits are hooking up buffer-saved and buffer-enter events, then it runs tslint, and then it pushes the errors back to Oni uses the Oni.diagnostics.setErrors API.

There aren't too many Oni plugins yet, this could potentially be the first external one ;)

The only caveat is the Oni API is in flux - but that's on my end to figure out... I'm looking at ways to have a graceful degradation when I plan on changing the API surface area.

Flow

Looks like there is a language server implementation of Flow, which is great! I see one here: https://github.com/flowtype/flow-language-server

Seems like that would be the easiest way to hook up. I have an example implementation against a C# language server here: https://github.com/extr0py/oni-language-csharp

The place to look there is in the Oni.createLanugageClient API.

For language servers that have simple initialization requirements (ie, they don't care too much about finding a root path), I'd like to simplify the language server by having it just be a configuration value - that work is tracked in #504 .

The only other item here is that, Oni is hardcoded to bring in the typescript language service for JS/TS files at the moment (to give out-of-the-box completion for web projects). For cases where the user would prefer to use the Flow language service, we'd want to give them an option to disable the default typescript language service behavior.

Hope that helps - let me know if you have any other questions about those existing plugins or how they could work with Flow / ESLint

Is there any update on Flow support?

@bryphe, I've had a quick look at implementing this though atm registering another language server for JS throws a duplicate error and the tss seems to take precedence so I've added an additional config var to use flow or tss, useFlow: true more or less.

Thanks @Akin909 for your investigation here & fixes here!

Really appreciate the documentation you added : https://github.com/onivim/oni/wiki/Language-Support#javascript-and-flow

Will close this out since we now have a documented path for enabling flow in lieu of tsserver. Keep us posted @rrichardson and @mxstbr if you hit any roadblocks.

Flow support is now there but ESlint is still missing, right?

Ah my fault, missed the eslint aspect - thanks for the heads up @hoschi ! I'll open a new issue to track and keep this one focused on the flow support.

Opened #1259 to track eslint (and discuss how we incorporate linters in general)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akinsho picture akinsho  路  3Comments

tcoopman picture tcoopman  路  3Comments

LucianBuzzo picture LucianBuzzo  路  3Comments

magopian picture magopian  路  3Comments

timeyyy picture timeyyy  路  3Comments