Skip to content

Commit

Permalink
Merge pull request #1045 from KacperFKorban/symbol-search/handle-indu…
Browse files Browse the repository at this point in the history
…ctive-and-fixpoint

Symbol search: handle inductive, fixpoint, and cofixpoint
  • Loading branch information
rtetley authored Feb 21, 2025
2 parents 4dafbd4 + f293259 commit 412a8c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions language-server/dm/document.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module SM = Map.Make (Stateid)
type proof_block_type =
| TheoremKind of Decls.theorem_kind
| DefinitionType of Decls.definition_object_kind
| InductiveType of Vernacexpr.inductive_kind
| Other

type proof_step = {
Expand Down Expand Up @@ -189,6 +190,8 @@ let record_outline document id (ast : Synterp.vernac_control_entry) classif (out
match pure with
| Vernacexpr.VernacStartTheoremProof (kind, _) -> Some (TheoremKind kind)
| Vernacexpr.VernacDefinition ((_, def), _, _) -> Some (DefinitionType def)
| Vernacexpr.VernacFixpoint (_, _) -> Some (DefinitionType Decls.Fixpoint)
| Vernacexpr.VernacCoFixpoint (_, _) -> Some (DefinitionType Decls.CoFixpoint)
| _ -> None
in
let name = match names with
Expand All @@ -212,6 +215,9 @@ let record_outline document id (ast : Synterp.vernac_control_entry) classif (out
match pure with
| Vernacexpr.VernacStartTheoremProof (kind, _) -> Some (TheoremKind kind), string_of_id document id
| Vernacexpr.VernacDefinition ((_, def), _, _) -> Some (DefinitionType def), string_of_id document id
| Vernacexpr.VernacInductive (kind, _) -> Some (InductiveType kind), string_of_id document id
| Vernacexpr.VernacFixpoint (_, _) -> Some (DefinitionType Decls.Fixpoint), string_of_id document id
| Vernacexpr.VernacCoFixpoint (_, _) -> Some (DefinitionType Decls.CoFixpoint), string_of_id document id
| _ -> None, ""
in
let name = match names with
Expand Down
1 change: 1 addition & 0 deletions language-server/dm/document.mli
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type document
type proof_block_type =
| TheoremKind of Decls.theorem_kind
| DefinitionType of Decls.definition_object_kind
| InductiveType of Vernacexpr.inductive_kind
| Other

type proof_step = {
Expand Down
1 change: 1 addition & 0 deletions language-server/dm/documentManager.ml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ let get_document_symbols st =
let kind = begin match type_ with
| TheoremKind _ -> SymbolKind.Function
| DefinitionType _ -> SymbolKind.Variable
| InductiveType _ -> SymbolKind.Struct
| Other -> SymbolKind.Null
end in
DocumentSymbol.{name; detail=(Some statement); kind; range; selectionRange=range; children=None; deprecated=None; tags=None;}
Expand Down

0 comments on commit 412a8c3

Please sign in to comment.