Skip to content
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

Remove lsp bloat #148

Merged
merged 20 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ on:
pull_request:
push:
branches:
- master
- main
- "releases/*"
jobs:
hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: "Set up HLint"
uses: rwe/actions-hlint-setup@v1
with:
version: "3.1.6"
version: "3.6.1"

- name: "Run HLint"
uses: rwe/actions-hlint-run@v2
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ clean:
@cabal clean

test:
@cabal run eclair-test
# next line is broken on CI
#@cabal run eclair-lsp-test
@DATALOG_DIR=cbits/ cabal run eclair-test
@lit tests/ -v

cabal-file:
Expand Down
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ packages: .
source-repository-package
type: git
location: https://github.com/luc-tielen/llvm-codegen.git
tag: 42043c279797a4f57e254fcf5e60f3df56f9bf65
tag: 497c7c0ffad5f3e4b6f4e74550a477e75b0beb23

source-repository-package
type: git
location: https://github.com/luc-tielen/souffle-haskell.git
tag: 51786c809e6b5db9d0da80b9821ed87654f620c7
tag: bcd7e3c058c9036d8495cf114520663917b7ac81

source-repository-package
type: git
Expand Down
184 changes: 21 additions & 163 deletions eclair-lang.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ library
Eclair.EIR.Lower.Codegen
Eclair.EIR.Lower.Externals
Eclair.Error
Eclair.JSON
Eclair.LLVM.Allocator.Arena
Eclair.LLVM.Allocator.Common
Eclair.LLVM.Allocator.Malloc
Eclair.LLVM.Allocator.Page
Expand All @@ -79,6 +81,15 @@ library
Eclair.LLVM.Table
Eclair.LLVM.Template
Eclair.LLVM.Vector
Eclair.LSP
Eclair.LSP.Handlers
Eclair.LSP.Handlers.Diagnostics
Eclair.LSP.Handlers.DocumentHighlight
Eclair.LSP.Handlers.Hover
Eclair.LSP.JSON
Eclair.LSP.Monad
Eclair.LSP.Types
Eclair.LSP.VFS
Eclair.Parser
Eclair.RA.Codegen
Eclair.RA.IndexSelection
Expand Down Expand Up @@ -127,9 +138,12 @@ library
, containers <1
, dependent-sum >=0.6 && <1
, diagnose >=2.3 && <2.4
, directory >=1 && <2
, dlist >=1 && <2
, exceptions >=0.10 && <0.11
, extra >=1 && <2
, ghc-prim <1
, hermes-json <1
, llvm-codegen
, megaparsec >=9 && <10
, mmorph >=1 && <2
Expand All @@ -143,6 +157,7 @@ library
, rock >=0.3 && <0.4
, souffle-haskell ==4.0.0
, text >=2 && <3
, text-builder-linear <1
, transformers <1
, vector >=0.12 && <0.13

Expand Down Expand Up @@ -232,176 +247,18 @@ executable eclair
ghc-options: -fplugin=StackTrace.Plugin
build-depends: haskell-stack-trace-plugin ==0.1.3.0

executable eclair-lsp-server
main-is: Main.hs
other-modules:
Eclair.LSP
Eclair.LSP.Diagnostics
Eclair.LSP.Handlers
Eclair.LSP.Monad
Paths_eclair_lang

autogen-modules: Paths_eclair_lang
hs-source-dirs: src/lsp
default-extensions:
DataKinds
DeriveAnyClass
DeriveFoldable
DeriveFunctor
DeriveGeneric
DeriveTraversable
DerivingStrategies
DerivingVia
FlexibleContexts
FlexibleInstances
KindSignatures
LambdaCase
OverloadedStrings
PatternSynonyms
RankNTypes
RecursiveDo
ScopedTypeVariables
TupleSections
TypeFamilies
ViewPatterns

ghc-options:
-Wall -Wincomplete-patterns -fhide-source-paths
-fno-show-valid-hole-fits -fno-sort-valid-hole-fits -threaded
-rtsopts -with-rtsopts=-N -Wall

cxx-options: -std=c++17 -D__EMBEDDED_SOUFFLE__
build-depends:
, aeson
, algebraic-graphs <1
, base >=4.7 && <5
, bytestring >=0.11 && <0.12
, comonad >=5 && <6
, containers <1
, data-default >=0.7 && <0.8
, dependent-sum >=0.6 && <1
, diagnose >=2.3 && <2.4
, directory >=1 && <2
, dlist >=1 && <2
, eclair-lang
, exceptions >=0.10 && <0.11
, extra >=1 && <2
, filepath >=1.4 && <1.5
, hslogger >=1.3 && <1.4
, lens >=5.2 && <5.3
, llvm-codegen
, lsp >=1.4 && <1.5
, lsp-types >=1.4 && <1.5
, megaparsec >=9 && <10
, mmorph >=1 && <2
, mtl >=2 && <3
, optparse-applicative >=0.16 && <0.17
, parser-combinators >=1.3 && <1.4
, prettyprinter >=1.7 && <1.8
, prettyprinter-ansi-terminal >=1 && <2
, recursion-schemes >=5 && <6
, relude >=1.2 && <1.3
, rock >=0.3 && <0.4
, rope-utf16-splay >=0.4 && <0.5
, souffle-haskell ==4.0.0
, text >=2 && <3
, transformers <1
, vector >=0.12 && <0.13

mixins: base hiding (Prelude)
default-language: Haskell2010

if os(osx)
extra-libraries: c++

if flag(debug)
ghc-options: -fplugin=StackTrace.Plugin
build-depends: haskell-stack-trace-plugin ==0.1.3.0

test-suite eclair-lsp-test
type: exitcode-stdio-1.0
main-is: Main.hs
other-modules: Paths_eclair_lang
autogen-modules: Paths_eclair_lang
hs-source-dirs: tests/lsp
default-extensions:
DataKinds
DeriveAnyClass
DeriveFoldable
DeriveFunctor
DeriveGeneric
DeriveTraversable
DerivingStrategies
DerivingVia
FlexibleContexts
FlexibleInstances
KindSignatures
LambdaCase
OverloadedStrings
PatternSynonyms
RankNTypes
RecursiveDo
ScopedTypeVariables
TupleSections
TypeFamilies
ViewPatterns

ghc-options:
-Wall -Wincomplete-patterns -fhide-source-paths
-fno-show-valid-hole-fits -fno-sort-valid-hole-fits

cxx-options: -std=c++17 -D__EMBEDDED_SOUFFLE__
build-tool-depends: eclair-lang:eclair-lsp-server
build-depends:
, algebraic-graphs <1
, base >=4.7 && <5
, bytestring >=0.11 && <0.12
, comonad >=5 && <6
, containers <1
, dependent-sum >=0.6 && <1
, diagnose >=2.3 && <2.4
, dlist >=1 && <2
, eclair-lang
, exceptions >=0.10 && <0.11
, extra >=1 && <2
, hspec >=2.6.1 && <3.0.0
, llvm-codegen
, lsp >=1.4 && <1.5
, lsp-test >=0.14 && <0.15
, lsp-types >=1.4 && <1.5
, megaparsec >=9 && <10
, mmorph >=1 && <2
, mtl >=2 && <3
, optparse-applicative >=0.16 && <0.17
, parser-combinators >=1.3 && <1.4
, prettyprinter >=1.7 && <1.8
, prettyprinter-ansi-terminal >=1 && <2
, recursion-schemes >=5 && <6
, relude >=1.2 && <1.3
, rock >=0.3 && <0.4
, rope-utf16-splay >=0.4 && <0.5
, souffle-haskell ==4.0.0
, text >=2 && <3
, transformers <1
, vector >=0.12 && <0.13

mixins: base hiding (Prelude)
default-language: Haskell2010

if os(osx)
extra-libraries: c++

if flag(debug)
ghc-options: -fplugin=StackTrace.Plugin
build-depends: haskell-stack-trace-plugin ==0.1.3.0

test-suite eclair-test
type: exitcode-stdio-1.0
main-is: test.hs

-- cabal-fmt: expand tests/eclair
other-modules:
Paths_eclair_lang
Test.Eclair.ArgParserSpec
Test.Eclair.JSONSpec
Test.Eclair.LLVM.HashSpec
Test.Eclair.LSP.HandlersSpec
Test.Eclair.LSP.JSONSpec
Test.Eclair.RA.IndexSelectionSpec

autogen-modules: Paths_eclair_lang
Expand Down Expand Up @@ -447,6 +304,7 @@ test-suite eclair-test
, extra >=1 && <2
, filepath >=1 && <2
, hedgehog >=1 && <2
, hermes-json <1
, hspec >=2.6.1 && <3.0.0
, hspec-hedgehog <1
, llvm-codegen
Expand Down
10 changes: 5 additions & 5 deletions lib/Eclair/Common/Location.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ lookupNodeId (SpanMap _ m) offset =

-- Helpers for producing error messages:

-- Line and column information. 1-based!
-- Line and column information. 0-based!
data SourcePos
= SourcePos
{ sourcePosLine :: {-# UNPACK #-} !Int
, sourcePosColumn :: {-# UNPACK #-} !Int
}
} deriving (Eq, Ord, Show)

data SourceSpan
= SourceSpan
{ sourceSpanFile :: FilePath
, sourceSpanBegin :: {-# UNPACK #-} !SourcePos
, sourceSpanEnd :: {-# UNPACK #-} !SourcePos
}
} deriving (Eq, Show)

spanToSourceSpan :: FilePath -> Text -> Span -> SourceSpan
spanToSourceSpan path text span'@(Span begin end) =
Expand All @@ -90,8 +90,8 @@ spanToSourceSpan path text span'@(Span begin end) =
beginPos' <- P.getSourcePos
_ <- P.takeP Nothing diff
endPos' <- P.getSourcePos
let beginSourcePos = SourcePos (line beginPos') (column beginPos')
endSourcePos = SourcePos (line endPos') (column endPos')
let beginSourcePos = SourcePos (line beginPos' - 1) (column beginPos' - 1)
endSourcePos = SourcePos (line endPos' - 1) (column endPos' - 1)
pure $ SourceSpan path beginSourcePos endSourcePos
where
diff = end - begin
Expand Down
Loading
Loading