Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Remove JSON transport #1105

Closed
wants to merge 20 commits into from
Closed

Conversation

lukel97
Copy link
Collaborator

@lukel97 lukel97 commented Feb 25, 2019

This PR removes the JSON transport in an attempt to simplify the internal architecture.
I have removed a lot of stuff aggressively and I expect I've removed too much: Please let me know if I should put anything back in!

Changes

  • Plugins now define their PluginId themselves. Will help with plugins becoming standalone (and maybe eventually with dynamic loading)
  • Plugin names and descriptions have been removed as they were only used by the JSON transport and were for displaying human readable strings when querying them
  • Commands are now more tightly coupled with LSP commands, and so functionality in GhcMod.hs that was exposed as a command but not exposed to LSP no longer define commands.
  • Modules that weren't actually Plugins in Haskell.Ide.Engine.Plugin have been moved up a level
  • PluginId and CommandId are newtype'd
  • Case splitting has been moved to HaRe

Todo

@mpickering
Copy link
Collaborator

What's the motivation for this so I can understand the internal architecture better?

@Anrock
Copy link
Collaborator

Anrock commented Mar 1, 2019

@mpickering there is an option for hie binary for producing non LSP-compliant JSON on stdio. AFAIK it was implemented long time ago when LSP wasn't a thing (at least in hie) and since that time nobody cared about it because LSP is the main protocol of hie for 99% of use cases.
Basically this PR should throw away code for non-lsp json transport and readjust/simplify other code.

@alanz alanz modified the milestones: 2019-02, 2019-03 Mar 2, 2019
@lukel97
Copy link
Collaborator Author

lukel97 commented Mar 3, 2019

Eventually, plugins may be loaded dynamically and would be specified by the user. If this PR removes plugin names then we need to look at namespacing and preventing conflicts when registering LSP command IDs.

@mpickering
Copy link
Collaborator

Adding a name to a plugin is not that hard so you should probably just keep the field.

@lukel97
Copy link
Collaborator Author

lukel97 commented Mar 6, 2019

@alanz @mpickering I just realised: The commands were already namespaced with pluginId, which was kept. pluginName was just a vanity name for display it looks like

@alanz alanz modified the milestones: 2019-03, 2019-04 Apr 6, 2019
@lukel97 lukel97 requested review from alanz, wz1000 and lorenzo April 23, 2019 19:02
@lukel97 lukel97 marked this pull request as ready for review April 23, 2019 19:02
Copy link
Collaborator

@lorenzo lorenzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@lukel97 lukel97 force-pushed the remove-json-stdio branch from 2701d3d to 06769da Compare April 24, 2019 07:40
, liquidDescriptor
, packageDescriptor
, pragmasDescriptor
, floskellDescriptor
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I put in the plugin id string when the plugin list is assembled is so that people can easily change the list of installed plugins, and only need to worry about possible name clashes in one place, namely here. By delegating it to the individual plugins we lose this capability.

Unless there is some other mechanism to disambiguate them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might need a larger discussion about how loading plugins will eventually look like.
I'm also thinking it might make more sense to remove pluginId as a field from PluginDescriptor, and have HIE generate a unique id at launch instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scrap that thought: It's used by liquid/ghc-mod and floskell/brittany to get specific plugins

, pluginSymbolProvider = Nothing
, pluginFormattingProvider = Nothing
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where has this moved to? why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Hoogle plugin didn't have any providers, and the lookup and info commands were just used as a part of haddock when it provides documentation (which are now just called directly instead of via the reactor). If the plugin doesn't provide any providers, it becomes a no-op to HIE, so I thought it would make sense to remove it as a plugin and make it more of a utility module for Hoogle related functions. i.e. if the user disabled the Hoogle plugin, nothing would happen: haddock still calls the methods here regardless.

@alanz alanz modified the milestones: 2019-04, 2019-05 May 4, 2019
@alanz
Copy link
Collaborator

alanz commented May 5, 2019

@bubba I think I broke this with the recent commits, it needs a refresh

@lukel97 lukel97 mentioned this pull request May 5, 2019
@alanz alanz modified the milestones: 2019-05, 2019-06 Jun 1, 2019
@alanz alanz modified the milestones: 2019-06, Some time Jul 7, 2019
@lukel97 lukel97 mentioned this pull request Dec 22, 2019
1 task
@alanz
Copy link
Collaborator

alanz commented Dec 22, 2019

To avoid confusion, perhaps you should close the PR?

@lukel97
Copy link
Collaborator Author

lukel97 commented Dec 22, 2019

Superseded by #1489 and #1492

@lukel97 lukel97 closed this Dec 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants