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

Remove JSON transport #1489

Merged
merged 5 commits into from Dec 22, 2019
Merged

Remove JSON transport #1489

merged 5 commits into from Dec 22, 2019

Conversation

lukel97
Copy link
Collaborator

@lukel97 lukel97 commented Dec 22, 2019

A fresh take on #1105

Stuff to do

  • Remove plugin descriptions, they're no longer needed

@lukel97 lukel97 marked this pull request as ready for review December 22, 2019 01:57
@@ -22,27 +22,6 @@ import Text.HTML.TagSoup.Tree

-- ---------------------------------------------------------------------

hoogleDescriptor :: PluginId -> PluginDescriptor
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hoogle Plugin does not exist anymore? Out of curiosity, what does that mean? Was it previously possible to invoke the PluginCommands "info" and "lookup" without a hover request? Or is this change unobservable for the lsp client?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Through LSP no, it was for when the JSON transport could run plugin commands directly. The functionality is still there in the lookup/info cmds, just not registered as a command.

lookupCmd' n term = do
-- | 'lookup' @n term@ looks up the given Text in the local Hoogle database.
-- Takes the first @n@ matches.
-- May fail with a HoogleError that can be shown to the user.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: Indentation a bit off


-- ---------------------------------------------------------------------

baseDescriptor :: PluginId -> PluginDescriptor
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question as for hoogle plugin. What does this entail for lsp-clients?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This has no change for LSP clients, it was only used for querying information about plugins from the JSON transport and isn't accessible via LSP

Comment on lines 286 to 287
, commandDesc :: T.Text
, commandFunc :: CommandFunc a b
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is the description removed and the CommandFunc? Are these remnants from JsonStdio? Is the description displayed somewhere for lsp-clients?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Descriptions and name were only used for the plugin querying commands in base, which aren't accessible through LSP anymore. PluginCommand should now be isomorphic to the LSP commands

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 removed CommandFunc just to simplify things. I think it's more illustrative to have the function type directly visible inside PluginCommand and it removes the redundant

xCmd :: CmdFunc a b
xCmd' :: a -> IdeGhcM (IdeResult b)

pattern


newtype CommandFunc a b = CmdSync (a -> IdeGhcM (IdeResult b))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this removed? Dont we need it anymore? Just for understanding the PR.

Copy link
Collaborator

@alanz alanz left a comment

Choose a reason for hiding this comment

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

To me this PR seems to be doing two unrelated things

  1. Remove the JsonStdio transport
  2. Rework the way commands are routed
    Perhaps it should be split into two?

app/MainHie.hs Outdated
, hsimportDescriptor "hsimport"
, liquidDescriptor "liquid"
, packageDescriptor "package"
, pragmasDescriptor "pragmas"
, floskellDescriptor "floskell"
, biosDescriptor "bios"
, genericDescriptor "generic"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we removing the base, hoogle and bios plugins?

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 base plugin was only used by the JSON transport to query existing plugins, LSP can't access them

      [ PluginCommand "version" "return HIE version" versionCmd
       , PluginCommand "plugins" "list available plugins" pluginsCmd
       , PluginCommand "commands" "list available commands for a given plugin" commandsCmd
       , PluginCommand "commandDetail" "list parameters required for a given command" commandDetailCmd

Same goes for Hoogle and Bios, they only exposed commands that LSP can't access, so it didn't make much sense to keep them around as plugins

, pluginCommands =
[ PluginCommand "applyOne" "Apply a single hint" applyOneCmd
, PluginCommand "applyAll" "Apply all hints to the file" applyAllCmd
, PluginCommand "lint" "Run hlint on the file to generate hints" lintCmd
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this being removed?

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 lint command isn't accessible via LSP, i.e. Server.hs just manually calls lint to send off the diagnostic notifications, and it doesn't make any sense for this to be a command in LSP (I don't think commands can really return anything or than workspace edits?). applyOne/applyAll are still there since code actions can call them

Comment on lines 93 to 96
-- | Add a package to the project's dependencies.
-- May fail if no project dependency specification can be found.
-- Supported are `*.cabal` and `package.yaml` specifications.
-- Moreover, may fail with an IOException in case of a filesystem problem.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is one of the benefits of removing the CommandFunc wrapper, as it allows us to coalesce all the xCmd xCmd' functions into just one. This should be an NFC

@lukel97 lukel97 requested review from alanz and fendor December 22, 2019 14:06
@lukel97 lukel97 mentioned this pull request Dec 22, 2019
1 task
@lukel97 lukel97 added this to To do in Dec 2019 Release Dec 22, 2019
@lukel97 lukel97 moved this from To do to In progress in Dec 2019 Release Dec 22, 2019
Copy link
Collaborator

@alanz alanz left a comment

Choose a reason for hiding this comment

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

More focused PR, thanks

{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE TemplateHaskell #-}
module Haskell.Ide.Engine.Plugin.Base where
{-# LANGUAGE CPP, TemplateHaskell, OverloadedStrings #-}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you collapsing the pragmas?

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 am not sure. I think this came in when shuffling parts about from the old PR. Will fix

@lukel97 lukel97 merged commit 23892ca into master Dec 22, 2019
Dec 2019 Release automation moved this from In progress to Done Dec 22, 2019
alanz added a commit to alanz/haskell-ide-engine that referenced this pull request Dec 22, 2019
PR haskell#1489 removed the --lsp option, resulting in a hard failure if a
client uses it to start up the server.

Parse it, but ignore it, as an interim measure.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants