Skip to content
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

Major steps required (Roadmap) #1

Closed
6 of 9 tasks
alanz opened this issue Jan 25, 2020 · 54 comments
Closed
6 of 9 tasks

Major steps required (Roadmap) #1

alanz opened this issue Jan 25, 2020 · 54 comments
Labels
old_type: meta Planing and organizing other issues

Comments

@alanz
Copy link
Collaborator

alanz commented Jan 25, 2020

  • Plugins
  • Implicit Configuration
  • Multi-component / package (alpha, based on @mpickering work in progress)
  • stack hie-bios flag
  • cabal hie-bios flag
  • Terminal modules (module graph)
  • memory usage

2020-09-29 Update (@jneira)

@lukel97
Copy link
Collaborator

lukel97 commented Jan 26, 2020

stack hie bios
https://gist.github.com/chrisdone/7ef391e8445216f5e30b2665b85a6db2

@jneira
Copy link
Member

jneira commented Jan 27, 2020

Have you considered use precompiled executables to use plugins at runtime, instead compile at runtime them? I guess they should be executed as daemons (like the ide server itself), to avoid the start process overhead.
We could use a subset (?) of lsp json format to comunicate between the ide main server and the plugin executables, to no reinvent any wheel.
This way the plugins+lsp could be even used in a isolated way from a vscode extension. In fact maybe we could distribute them as separate vscode extensions, keeping in the server only the core interface with ghc: compile errors, goto def, etc

Caveats: we had to wrap each plugin lib (hlint, brittany, floskell, etc) or sets of plugins in a executable+lsp stdio+ghc interface wrapper and distribute the precompiled executables separately.

@jneira jneira pinned this issue Jan 27, 2020
@ndmitchell
Copy link
Collaborator

@jneira many plugins are going to require a GHC session. Either you can duplicate the GHC session to different processes (which is incredibly expensive in CPU terms), or marshal every GHC API call over to the GHC session (incredibly expensive in terms of communication). It would be nice if we could figure out a way that works, but I can't think of one.

@jneira
Copy link
Member

jneira commented Jan 27, 2020

Mmm i see. Thanks for sharing.

So add to the ide server a bridge between the ghc session and the plugins using a lsp-like format is not viable 😞

Still, could plugins not using the ghc session be isolated? Dont know much about each tool internals but maybe any of hoogle, hlint, liquid or any of formatters dont use a ghc session???

@ndmitchell
Copy link
Collaborator

Most plugins are likely to get something from the GHC environment - the parse tree, the text after preprocessing, the names on which to run searches. Looking at HLint and formatters like Ormulu, they should be using the GHC environment (they currently build their own GHC environment, which is a bit different).

@alanz
Copy link
Collaborator Author

alanz commented Jan 27, 2020

@jneira the approach fpcomplete took in their initial web-ide backend took that approach, and I understand had major issues with just sharing data between the various processes.

@alanz
Copy link
Collaborator Author

alanz commented Jan 27, 2020

Plus the prospect of the kinds of issues that will be raised because people are not able to get a set of separate processes running and talking to each other is not good. Think our current stuff x 10.

@jneira
Copy link
Member

jneira commented Jan 27, 2020

Sorry if i am adding a lot of nosense but i think @mpickering mentioned a library that tried to eval haskell code at runtime than maybe could be useful: not sure if it was https://github.com/stepcut/plugins

@fendor
Copy link
Collaborator

fendor commented Jan 27, 2020

Out of curiosity, did you have time to touch debugger integration? Or is it too soon to talk about such a feature?

@alanz
Copy link
Collaborator Author

alanz commented Jan 27, 2020

Out of curiosity, did you have time to touch debugger integration? Or is it too soon to talk about such a feature?

We had a brief conversation, which did not go anywhere in particular. I think it is something that needs to happen, sometime, but we first need to get over the initial process. Once haskell-ide is available for use, we can consider additional stuff.

@alanz
Copy link
Collaborator Author

alanz commented Jan 27, 2020

Just dumping this here, thoughts on range formatting. haskell/haskell-ide-engine#1602 (comment)

@NightRa
Copy link

NightRa commented Jan 28, 2020

Sounds like a perfect use case for dynamic linking @jneira @ndmitchell

@jneira
Copy link
Member

jneira commented Jan 28, 2020

Another question: could we continue using the hie solution to handle several ghcs using a wrapper?
I think it could be more beginner friendly although it has a point of friction trying to guess the ghc version used in a project.

Somewhat philosophical side note: it seems to me that ghcide is more used by (suited to?) experienced haskell developers. I think we have the opportunity and the challenge to build a tool well-balanced between beginners and more experienced haskell devs.

@jneira
Copy link
Member

jneira commented Jan 28, 2020

@NightRa coming from the jvm world, where it is the default way to go, i think so.
However i am not sure if it is widely used enough in the haskell world to not hit a lot of pain points (performance, bugs, etc, etc)

@ndmitchell
Copy link
Collaborator

Dynamic linking is not a well trodden path in Haskell. I would avoid it like the plague as it's no fun for support.

The plan is to do the HIE compiling lots of binaries thing.

@jneira
Copy link
Member

jneira commented Jan 28, 2020

The plan is to do the HIE compiling lots of binaries thing.

It has its own pain points especially for beginners, although i suppose they are better known and battle tested. Experience is king here (always? 😉) and absolutly trust @ndmitchell, @alanz and the surely thoughtful discussions at Bristol.
However to avoid too much (exponential?) slow static compilation combinations i would not totally abandon the alternative of break them via binaries wherever is factible. Even if we start to compile everything statically for the shake of simplicity.

@alanz
Copy link
Collaborator Author

alanz commented Jan 28, 2020

@jneira As far as I am concerned, the initial effort should be to end up with an equivalent setup here as we have for hie, in terms of the wrapper and build system.

Also, to achieve parity by migrating our existing plugins.

It is not the time to try experimental stuff, I would like to see something usable ASAP.

@jneira jneira added the old_type: meta Planing and organizing other issues label Jan 29, 2020
@alanz
Copy link
Collaborator Author

alanz commented Jan 29, 2020

As far as I am concerned, the initial effort should be to end up with an equivalent setup here as we have for hie, in terms of the wrapper and build system.

We are getting close to this, in the sense that we have copied it over, and done a smoke test.

I think the most important feature before we can recommend it to anyone is multi-component support.

@Anton-Latukha
Copy link
Collaborator

Anton-Latukha commented Feb 17, 2020

What is "Implicit Configuration" I guess "Settings", menus and buttons?

@jneira
Copy link
Member

jneira commented Feb 17, 2020

@Anton-Latukha if refers to the "automatic" configuration to start a ghc session with hie-bios, using cabal-helper (or other) to get the ghc flags instead an explicit hie.yaml file: see https://github.com/haskell/haskell-ide-engine#project-configuration

@complyue
Copy link

complyue commented May 4, 2020

Either you can duplicate the GHC session to different processes (which is incredibly expensive in CPU terms), or marshal every GHC API call over to the GHC session (incredibly expensive in terms of communication). It would be nice if we could figure out a way that works, but I can't think of one.

I'd done some components with an idea called Hosting Based Interfacing, basically you re-organize fine-grained API calls into coarse-grained, business-oriented, parametric pieces of peer script, send it to a remote process for (hosted) execution, the result (naturally asynchronous and in free form) is conveyed with similar pieces of such script back to the originating peer process.

In context here it means to have a single GHC session hosting process, receiving and executing scripts from various plugin processes, those scripts help themselves to grab necessary (thus amount-wise, greatly reduced than raw GHC api transcription payload) data and do scripting back.

This technique won't reduce the overall complexity, actually, writing a single piece of code that would run interleaved among 2 or more processes, is confusing and uncomfortable at times. But it is especially effective for realtime communicating services / clients over WAN, insensitive to the delay of double latency imposed by the round-trip of request/response cycles, which may more because of the async nature, another significant optimization is that, per api-call marshal/unmarshal is avoided, the total payload over-wire is greatly reduced.

Hosting Based Interface won't make it easier or simpler for multiple plugins to share a common GHC session, but may help developing a minimal thus hopefully more stable contract for what artifacts (i.e. constants, procedures etc.) to be hosted at a single GHC session process, while leaving the plugin processes enough flexibility and space of imagination to script the transactions to accomplish their jobs.

@jneira jneira unpinned this issue Jun 2, 2020
wz1000 referenced this issue in wz1000/haskell-language-server Sep 16, 2020
@jneira
Copy link
Member

jneira commented Sep 23, 2020

  • We are using the implicit hie-bios config via implicit-hie-cradle
  • Maybe we should revise the rest of tasks to determine if they are still relevant and open specific issues

//cc @alanz

@jneira jneira added the status: needs info Not actionable, because there's missing information label Sep 23, 2020
@alanz
Copy link
Collaborator Author

alanz commented Sep 23, 2020

but i like hie-bios-schema

Perhaps wait to see if there is any renaming of hie-bios? I get the impression the word "hie" is now an anachronism, and confuses newcomers. I think that ship has sailed though, it is pretty much baked in all over the place.

@alanz
Copy link
Collaborator Author

alanz commented Sep 23, 2020

And for the record, I agree that the schema belongs to hie-bios

@chrisdone
Copy link
Member

No preference for naming from me.

But this sets a nice dependency order: the patch for stack/cabal-install ought to be essentially (1) import lib, (2) fill in the data structures, (3) provide command that dumps the data structure to stdout.

There might be some back and forth if there's a field I can't provide from Stack, those could be Maybed.

I don't have much bandwidth for tooling anymore. But I can get low overhead changes into Stack like this.

@jneira
Copy link
Member

jneira commented Sep 24, 2020

Nice, @chrisdone thanks for take care.
@fendor @bubba how could this plan fit your work in cabal-install show-build-info?

@fendor
Copy link
Collaborator

fendor commented Sep 24, 2020

I like the plan, I wasn't aware that we are actually this close to have tooling support in cabal and stack 😮.
I think we should discuss the contents of the package hie-bios-schema (or similar) at the hie-bios repository to not pollute the big picture here, and since hie-bios and hie-bios-schema will have to work together. We also need to think about the API changes this entails to hie-bios, since now there are multiple trade offs to discuss, such as eager vs lazy loading of components, query by filepath or query by component, etc...
We should converge on a datatype, ideally before haskell/cabal#6241 is merged, to make adjustment to the PR to fit immediately what we need. I expect any backwards incompatible changes will be hard to get into cabal.

For the implementation plan in cabal, I am not sure they will add new dependencies to it, such as aeson or hie-bios-schema, and I think, usually such types are added to cabal-plan, which is fine I think.

@chrisdone I missing some information, such as path to ghc, libdir/topdir, maybe ghc version and the actual compilation options required to compile the component with. At least, judging from what I can see in the output https://gist.github.com/chrisdone/7ef391e8445216f5e30b2665b85a6db2 and the code in https://github.com/commercialhaskell/stack/compare/add-stack-ide-bios-cmd.

EDIT: BTW, I volunteer/want to maintain a library such as hie-bios-schema

@jneira
Copy link
Member

jneira commented Sep 29, 2020

We already are using ghcide master

pepeiborra pushed a commit that referenced this issue Dec 27, 2020
@jneira
Copy link
Member

jneira commented Jan 11, 2021

@fendor out of curisoity, have you the opportunity of make some progress about the cabal/stack integration?

@fendor
Copy link
Collaborator

fendor commented Jan 20, 2021

@jneira Unfortunately, not at all. I have been occupied with other stuff :(

@jneira
Copy link
Member

jneira commented Jan 20, 2021

no worries, maybe we can reactivate it via the next Gsoc?

@fendor
Copy link
Collaborator

fendor commented Jan 20, 2021

That is definitely a good idea!

@andys8
Copy link
Collaborator

andys8 commented Feb 8, 2021

Regarding module graph: the hiedb branch was merged.

@jneira
Copy link
Member

jneira commented Feb 8, 2021

@andys8 thanks for noting it, checklist updated

@jneira
Copy link
Member

jneira commented Feb 24, 2021

I've labeled it as Eligible for gsoc 2021 due to

stack/cabal hie-bios flag: upstream changes in cabal/stack to make them give precise build info to hie-bios

cabal @fendor/@bubba show-build-info: haskell/cabal#6241
stack @chrisdone branch https://github.com/commercialhaskell/stack/compare/add-stack-ide-bios-cmd

It has not a dedicated issue
//cc @fendor

@jneira
Copy link
Member

jneira commented Jun 17, 2021

Plugin architecture check done!

@jneira
Copy link
Member

jneira commented Jul 20, 2021

cabal show-build-infohas a new pr, we hope it will be the definitive one! haskell/cabal#7478

@chrisdone
Copy link
Member

I can apply the stack command when needed, but what’s the latest summary of the JSON format?

It’s a year and a half later... 😳

@jneira
Copy link
Member

jneira commented Jul 20, 2021

"las cosas de palacio van despacio" 😝

maybe the JSON format is already specified, even informally, @fendor?

@fendor
Copy link
Collaborator

fendor commented Jul 20, 2021

As I think hie-bios is the more fitting repository for this discussion, I responded here: haskell/hie-bios#269 (comment)

I thought, maybe it is here just too much noise.

@jneira
Copy link
Member

jneira commented Nov 26, 2021

I love this venerable issue with the great initial @alanz vision of how could be the hls path.
However i think all points are done or reflected in other issues and not sure if we need keep this open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
old_type: meta Planing and organizing other issues
Projects
None yet
Development

No branches or pull requests

10 participants