-
-
Notifications
You must be signed in to change notification settings - Fork 398
[plugin][refine-import] Do not refine to Internal module #1832
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
Conversation
-- directly | ||
let notContainInternalModule :: [AvailInfo] -> Bool | ||
notContainInternalModule = not . any (\a -> | ||
"Internal" `isSuffixOf` prettyPrint (availName a)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be too hard to add configuration for the internal suffix - @berberman and @isovector are the experts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rayshih had the example above helped to implement the config of the internal suffix?
@rayshih it seems it only needs make configurable the internal modules prefix, do you have still plans to continue working on this? thanks! |
I would operate on the fact that I consider it as good. As it is an improvement. & I can understand the both design approaches, to encourage only recommended & to complicate the bad, and the approach to allow customization even if What we currently have is done in the default way & seems to roughly cover the Pareto balance. In the majority of cases, we do want this default. Generally, people indeed do not want/should not depend on & in 20% of cases when they want to depend on Why to avoid |
I would appeal to reason that to keep people away from refining into |
When a contributor does not address a request - there is no way around it. In that case it is useful to readdress the request to the community to decide if that would be needed enough to be implemented. I relocated the request for the plugin customization option into report #2521. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code seems simple enough that I can review it & the code is clear to me. Indeed even tests are there.
well I think configure the name schema to filter suggestions would generalise this nicely to "filter out modules which I don't want" in suggestions, for any reason, not only being internal imo the last thing is required, as we are gonna change an actual behaviour and bother users who want to use internal modules |
Closing as dead. |
So we shouldn't refine imports to use internal modules, for example the following should not happen:
refined to
corresponding test attached :)