-
-
Notifications
You must be signed in to change notification settings - Fork 412
Open
Labels
Description
Feature request
Currently, the plugin requires people to manually refine imports if user wants to depend on Internal uncontrolled API.
Solution
It should not be too hard to add the option into the plugin:
An example of Properties in type lenses plugin:
haskell-language-server/ghcide/src/Development/IDE/Plugin/TypeLenses.hs
Lines 89 to 112 in 7d7cfa2
| descriptor :: PluginId -> PluginDescriptor IdeState | |
| descriptor plId = | |
| (defaultPluginDescriptor plId) | |
| { pluginHandlers = mkPluginHandler STextDocumentCodeLens codeLensProvider | |
| , pluginCommands = [PluginCommand (CommandId typeLensCommandId) "adds a signature" commandHandler] | |
| , pluginRules = rules | |
| , pluginConfigDescriptor = defaultConfigDescriptor {configCustomConfig = mkCustomConfig properties} | |
| } | |
| properties :: Properties '[ 'PropertyKey "mode" ('TEnum Mode)] | |
| properties = emptyProperties | |
| & defineEnumProperty #mode "Control how type lenses are shown" | |
| [ (Always, "Always displays type lenses of global bindings") | |
| , (Exported, "Only display type lenses of exported global bindings") | |
| , (Diagnostics, "Follows error messages produced by GHC about missing signatures") | |
| ] Always | |
| codeLensProvider :: | |
| IdeState -> | |
| PluginId -> | |
| CodeLensParams -> | |
| LSP.LspM Config (Either ResponseError (List CodeLens)) | |
| codeLensProvider ideState pId CodeLensParams{_textDocument = TextDocumentIdentifier uri} = do | |
| mode <- usePropertyLsp #mode pId properties |
Alternatives solution
The current design can be seen as a good design, as it encourages best practices & discourages the use of uncontrolled Internal API: http://nikita-volkov.github.io/internal-convention-is-a-mistake.
But, still, people may have strong reasons & requirements to be able to refine into Internal modules when they need.