Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
Haskell Language Server
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haskell
Haskell Language Server
Commits
c2f6c19e
Unverified
Commit
c2f6c19e
authored
3 years ago
by
Bodigrim
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Implement stripPrefix via T.stripPrefix (#2645)
parent
0905e682
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
+3
-6
3 additions, 6 deletions
ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
with
3 additions
and
6 deletions
ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
+
3
−
6
View file @
c2f6c19e
...
...
@@ -31,6 +31,7 @@ import Data.Function (on)
import
Data.Functor
import
qualified
Data.HashMap.Strict
as
HM
import
qualified
Data.HashSet
as
HashSet
import
Data.Monoid
(
First
(
..
))
import
Data.Ord
(
Down
(
Down
))
import
qualified
Data.Set
as
Set
import
Development.IDE.Core.Compile
...
...
@@ -757,12 +758,8 @@ openingBacktick line prefixModule prefixText Position { _character=(fromIntegral
-}
-- TODO: Turn this into an alex lexer that discards prefixes as if they were whitespace.
stripPrefix
::
T
.
Text
->
T
.
Text
stripPrefix
name
=
T
.
takeWhile
(
/=
':'
)
$
go
prefixes
where
go
[]
=
name
go
(
p
:
ps
)
|
T
.
isPrefixOf
p
name
=
T
.
drop
(
T
.
length
p
)
name
|
otherwise
=
go
ps
stripPrefix
name
=
T
.
takeWhile
(
/=
':'
)
$
fromMaybe
name
$
getFirst
$
foldMap
(
First
.
(`
T
.
stripPrefix
`
name
))
prefixes
-- | Prefixes that can occur in a GHC OccName
prefixes
::
[
T
.
Text
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment