-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lsp] Implement
textDocument/selectionRange
.
We return the range of the Coq sentence underlying the cursor. In VSCode, this is triggered by the "Expand Selection" command. Note the current implementation is partial: we only take into account the first position, and we only return a single range (Coq sentence) without parents. This could be of help for #580.
- Loading branch information
Showing
11 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
(************************************************************************) | ||
(* * The Coq Proof Assistant / The Coq Development Team *) | ||
(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *) | ||
(* <O___,, * (see CREDITS file for the list of authors) *) | ||
(* \VV/ **************************************************************) | ||
(* // * This file is distributed under the terms of the *) | ||
(* * GNU Lesser General Public License Version 2.1 *) | ||
(* * (see LICENSE file for the text of the license) *) | ||
(************************************************************************) | ||
|
||
(************************************************************************) | ||
(* Coq Language Server Protocol *) | ||
(* Copyright 2019 MINES ParisTech -- Dual License LGPL 2.1 / GPL3+ *) | ||
(* Copyright 2019-2023 Inria -- Dual License LGPL 2.1 / GPL3+ *) | ||
(* Written by: Emilio J. Gallego Arias *) | ||
(************************************************************************) | ||
|
||
let request ~doc ~point = | ||
let approx = Fleche.Info.Exact in | ||
match Fleche.Info.LC.node ~doc ~point approx with | ||
| None -> Ok `Null | ||
| Some node -> | ||
let range = Fleche.Doc.Node.range node in | ||
let parent = None in | ||
let answer = Lsp.Core.SelectionRange.({ range; parent } |> to_yojson) in | ||
Ok (`List [ answer ]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(************************************************************************) | ||
(* * The Coq Proof Assistant / The Coq Development Team *) | ||
(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *) | ||
(* <O___,, * (see CREDITS file for the list of authors) *) | ||
(* \VV/ **************************************************************) | ||
(* // * This file is distributed under the terms of the *) | ||
(* * GNU Lesser General Public License Version 2.1 *) | ||
(* * (see LICENSE file for the text of the license) *) | ||
(************************************************************************) | ||
|
||
(************************************************************************) | ||
(* Coq Language Server Protocol *) | ||
(* Copyright 2019 MINES ParisTech -- Dual License LGPL 2.1 / GPL3+ *) | ||
(* Copyright 2019-2023 Inria -- Dual License LGPL 2.1 / GPL3+ *) | ||
(* Written by: Emilio J. Gallego Arias *) | ||
(************************************************************************) | ||
|
||
val request : Request.position |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters