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

[ refactor ] IDE protocol as a separate module hierarchy #2171

Merged
merged 26 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0b3f965
Start refactoring the protocols to their separate module hierarchy
Dec 6, 2021
0e2a4f2
Add missing ipkg dependency
ohad Dec 6, 2021
2ac0344
Rename the package file because it messes up with interactive editing…
Dec 7, 2021
d1a2f87
Refactor: move some more SExp / IDE Message code into the new hierarchy
Dec 7, 2021
3a5029e
Refactor: structure ExprSearch to use Hints record
Dec 7, 2021
87f7fb9
Start adding top-level messages (replies and requests)
Dec 7, 2021
d83d13c
Add missing package
Dec 8, 2021
349fbd7
Refactor printing of results (without highlighting) through the protocol
Dec 8, 2021
dd8914f
Refactor the syntax highlighting code into the IDE protocol
Dec 8, 2021
72c3427
Update expected test results for ideMode tests
Dec 8, 2021
0288951
Bump the ProtocolVersion number in the convensional way
Dec 8, 2021
d2e79d8
Update the ideMode tests to expect the new protocol version number
Dec 9, 2021
fa0311a
Complete the first draft of the IDE protocol
Dec 9, 2021
9e8c769
Refactor IDE.Result to use specialised record types
Dec 10, 2021
97ed2b1
Implement most of the de-serialisation code (untested)
Dec 10, 2021
ca5cc52
Finish deserialisation code (untested)
Dec 10, 2021
7ee8eef
Remove stale comment
ohad Dec 16, 2021
e6b4930
Remove another stale comment
ohad Dec 16, 2021
71b4c95
Use a (now) existing interface
ohad Dec 16, 2021
44491dd
Add totality annotation
ohad Dec 16, 2021
0110fce
Add default totality annotation
ohad Dec 16, 2021
d6732d1
Add default totality annotation
ohad Dec 16, 2021
c70099d
Add default totality annotation
ohad Dec 16, 2021
3371a5e
Add default totality annotations
ohad Dec 16, 2021
e62d4fc
Merge remote-tracking branch 'origin/main' into ide-messages
Dec 16, 2021
5af47cd
[ fix ] merge conflict
gallais Dec 16, 2021
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
14 changes: 13 additions & 1 deletion idris2api.ipkg
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ modules =
Idris.IDEMode.Holes,
Idris.IDEMode.MakeClause,
Idris.IDEMode.Parser,
Idris.IDEMode.Pretty,
Idris.IDEMode.REPL,
Idris.IDEMode.SyntaxHighlight,
Idris.IDEMode.TokenLine,
Expand Down Expand Up @@ -159,6 +160,7 @@ modules =
Libraries.Data.NameMap.Traversable,
Libraries.Data.PosMap,
Libraries.Data.Primitives,
Libraries.Data.Span,
Libraries.Data.SortedMap,
Libraries.Data.SortedSet,
Libraries.Data.String.Extra,
Expand Down Expand Up @@ -190,7 +192,6 @@ modules =
Libraries.Text.Token,

Libraries.Utils.Binary,
Libraries.Utils.Hex,
Libraries.Utils.Octal,
Libraries.Utils.Path,
Libraries.Utils.Scheme,
Expand All @@ -210,6 +211,17 @@ modules =
Parser.Rule.Package,
Parser.Rule.Source,

Protocol.IDE,
Protocol.IDE.Command,
Protocol.IDE.Decoration,
Protocol.IDE.FileContext,
Protocol.IDE.Formatting,
Protocol.IDE.Holes,
Protocol.IDE.Result,
Protocol.IDE.Highlight,
Protocol.Hex,
Protocol.SExp,

TTImp.BindImplicits,
TTImp.Elab,
TTImp.Impossible,
Expand Down
20 changes: 20 additions & 0 deletions idris2protocols.ipkg.hide
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package idris-protocols
version = 0.0.1

modules
= Protocol.Hex
, Protocol.IDE
, Protocol.IDE.Command
, Protocol.IDE.Decoration
, Protocol.SExp
, Libraries.Data.Span
, Protocol.IDE.FileContext
, Protocol.IDE.Formatting
, Protocol.IDE.Holes
, Protocol.IDE.Result
, Protocol.IDE.Highlight


--depends =

sourcedir = "src"
2 changes: 1 addition & 1 deletion src/Compiler/ES/Codegen.idr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Compiler.ES.TailRec
import Compiler.ES.State
import Compiler.NoMangle
import Libraries.Data.SortedMap
import Libraries.Utils.Hex
import Protocol.Hex
import Libraries.Data.String.Extra

import Data.Vect
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/RefC/RefC.idr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Data.Vect
import System
import System.File

import Libraries.Utils.Hex
import Protocol.Hex
import Libraries.Utils.Path

%default covering
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Scheme/Chez.idr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Core.Directory
import Core.Name
import Core.Options
import Core.TT
import Libraries.Utils.Hex
import Protocol.Hex
import Libraries.Utils.Path

import Data.List
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Scheme/Gambit.idr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Core.Directory
import Core.Name
import Core.Options
import Core.TT
import Libraries.Utils.Hex
import Protocol.Hex
import Libraries.Utils.Path

import Data.List
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Scheme/Racket.idr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Core.Context.Log
import Core.Directory
import Core.Name
import Core.TT
import Libraries.Utils.Hex
import Protocol.Hex
import Libraries.Utils.Path

import Data.List
Expand Down
42 changes: 2 additions & 40 deletions src/Core/Metadata.idr
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,9 @@ import System.File
import Libraries.Data.PosMap
import Libraries.Utils.Binary

%default covering
import public Protocol.IDE.Decoration as Protocol.IDE

public export
data Decoration : Type where
Comment : Decoration
Typ : Decoration
Function : Decoration
Data : Decoration
Keyword : Decoration
Bound : Decoration
Namespace : Decoration
Postulate : Decoration
Module : Decoration
%default covering

export
nameDecoration : Name -> NameType -> Decoration
Expand All @@ -51,34 +41,6 @@ public export
SemanticDecorations : Type
SemanticDecorations = List ASemanticDecoration

public export
Eq Decoration where
Comment == Comment = True
Typ == Typ = True
Function == Function = True
Data == Data = True
Keyword == Keyword = True
Bound == Bound = True
Namespace == Namespace = True
Postulate == Postulate = True
Module == Module = True
_ == _ = False

-- CAREFUL: this instance is used in SExpable Decoration. If you change
-- it then you need to fix the SExpable implementation in order not to
-- break the IDE mode.
public export
Show Decoration where
show Comment = "comment"
show Typ = "type"
show Function = "function"
show Data = "data"
show Keyword = "keyword"
show Bound = "bound"
show Namespace = "namespace"
show Postulate = "postulate"
show Module = "module"

TTC Decoration where
toBuf b Typ = tag 0
toBuf b Function = tag 1
Expand Down
4 changes: 1 addition & 3 deletions src/Core/Name/Namespace.idr
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ DecEq Namespace where
-- TODO: move somewhere more appropriate
export
showSep : String -> List String -> String
showSep sep [] = ""
showSep sep [x] = x
showSep sep (x :: xs) = x ++ sep ++ showSep sep xs
showSep sep = Libraries.Data.String.Extra.join sep

export
showNSWithSep : String -> Namespace -> String
Expand Down
Loading