File tree 1 file changed +3
-1
lines changed
plugins/hls-pragmas-plugin/src/Ide/Plugin 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,8 @@ warningBlacklist = ["deferred-type-errors"]
137
137
-- | Offer to add a missing Language Pragma to the top of a file.
138
138
-- Pragmas are defined by a curated list of known pragmas, see 'possiblePragmas'.
139
139
suggestAddPragma :: Maybe DynFlags -> Diagnostic -> [PragmaEdit ]
140
- suggestAddPragma mDynflags Diagnostic {_message} = genPragma _message
140
+ suggestAddPragma mDynflags Diagnostic {_message, _source}
141
+ | _source == Just " typecheck" || _source == Just " parser" = genPragma _message
141
142
where
142
143
genPragma target =
143
144
[(" Add \" " <> r <> " \" " , LangExt r) | r <- findPragma target, r `notElem` disabled]
@@ -149,6 +150,7 @@ suggestAddPragma mDynflags Diagnostic {_message} = genPragma _message
149
150
-- When the module failed to parse, we don't have access to its
150
151
-- dynFlags. In that case, simply don't disable any pragmas.
151
152
[]
153
+ suggestAddPragma _ _ = []
152
154
153
155
-- | Find all Pragmas are an infix of the search term.
154
156
findPragma :: T. Text -> [T. Text ]
You can’t perform that action at this time.
0 commit comments