Skip to content

Commit

Permalink
Switch language service interface to use flat string as file URI
Browse files Browse the repository at this point in the history
  • Loading branch information
Viir committed Dec 22, 2024
1 parent 3c66f01 commit 72fea14
Show file tree
Hide file tree
Showing 12 changed files with 401 additions and 505 deletions.
11 changes: 7 additions & 4 deletions implement/example-apps/elm-editor/src/Frontend/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,8 @@ updateToProvideHoverRequest request workspaceStateBefore =
in
updateForRequestToLanguageService
(LanguageServiceInterface.ProvideHoverRequest
{ filePathOpenedInEditor = directoryPath ++ [ fileName ]
{ filePathOpenedInEditor =
String.join "/" (List.concat [ directoryPath, [ fileName ] ])
, positionLineNumber = request.positionLineNumber
, positionColumn = request.positionColumn
}
Expand All @@ -1421,7 +1422,8 @@ updateToProvideDefinitionRequest request workspaceStateBefore =
in
updateForRequestToLanguageService
(LanguageServiceInterface.ProvideDefinitionRequest
{ filePathOpenedInEditor = directoryPath ++ [ fileName ]
{ filePathOpenedInEditor =
String.join "/" (List.concat [ directoryPath, [ fileName ] ])
, positionLineNumber = request.positionLineNumber
, positionColumn = request.positionColumn
}
Expand All @@ -1445,7 +1447,8 @@ updateToProvideCompletionItemsRequest request workspaceStateBefore =
in
updateForRequestToLanguageService
(LanguageServiceInterface.ProvideCompletionItemsRequest
{ filePathOpenedInEditor = directoryPath ++ [ fileName ]
{ filePathOpenedInEditor =
String.join "/" (List.concat [ directoryPath, [ fileName ] ])
, cursorLineNumber = request.cursorLineNumber
, cursorColumn = request.cursorColumn
}
Expand Down Expand Up @@ -4281,7 +4284,7 @@ provideDefinitionInMonacoEditorCmd locationsInFiles =
monacoLocations =
List.map
(\locationInFile ->
{ uri = monacoUriForFilePath locationInFile.filePath
{ uri = monacoUriForFilePath [ locationInFile.filePath ]
, range = locationInFile.range
}
)
Expand Down
165 changes: 89 additions & 76 deletions implement/example-apps/elm-editor/src/LanguageService.elm

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ type alias RequestInWorkspace =


type Request
= AddFileRequest (List String) FileTreeBlobNode
| DeleteFileRequest (List String)
= AddFileRequest String FileTreeBlobNode
| DeleteFileRequest String
| ProvideHoverRequest ProvideHoverRequestStruct
| ProvideCompletionItemsRequest ProvideCompletionItemsRequestStruct
| ProvideDefinitionRequest ProvideDefinitionRequestStruct
| TextDocumentSymbolRequest (List String)
| TextDocumentSymbolRequest String
| TextDocumentReferencesRequest ProvideReferencesRequestStruct
| TextDocumentRenameRequest RenameParams

Expand All @@ -59,14 +59,14 @@ type Response


type alias ProvideHoverRequestStruct =
{ filePathOpenedInEditor : List String
{ filePathOpenedInEditor : String
, positionLineNumber : Int
, positionColumn : Int
}


type alias ProvideCompletionItemsRequestStruct =
{ filePathOpenedInEditor : List String
{ filePathOpenedInEditor : String
, cursorLineNumber : Int
, cursorColumn : Int
}
Expand All @@ -81,15 +81,15 @@ type alias ProvideReferencesRequestStruct =


type alias RenameParams =
{ filePath : List String
{ filePath : String
, positionLineNumber : Int
, positionColumn : Int
, newName : String
}


type alias LocationUnderFilePath =
{ filePath : List String
{ filePath : String
, range : Frontend.MonacoEditor.MonacoRange
}

Expand Down Expand Up @@ -130,7 +130,7 @@ type alias WorkspaceEdit =


type alias TextDocumentEdit =
{ filePath : List String
{ filePath : String
, edits : List TextEdit
}

Expand Down
Loading

0 comments on commit 72fea14

Please sign in to comment.