-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: denote deprecations in completion items (#5707)
This PR ensures that deprecated declarations are displayed with a strikethrough markup in the completion popup of VS Code and that the docstring of a completion item denotes the meta-data of the deprecation.
- Loading branch information
Showing
4 changed files
with
165 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
structure SomeStructure where | ||
n : Nat | ||
|
||
def SomeStructure.foo1 (s : SomeStructure) : Nat := s.n | ||
|
||
/-- A docstring. -/ | ||
def SomeStructure.foo2 (s : SomeStructure) : Nat := s.n | ||
|
||
@[deprecated] def SomeStructure.foo3 (s : SomeStructure) : Nat := s.n | ||
|
||
/-- A docstring. -/ | ||
@[deprecated] def SomeStructure.foo4 (s : SomeStructure) : Nat := s.n | ||
|
||
@[deprecated SomeStructure.foo1] def SomeStructure.foo5 (s : SomeStructure) : Nat := s.n | ||
|
||
/-- A docstring. -/ | ||
@[deprecated SomeStructure.foo1] def SomeStructure.foo6 (s : SomeStructure) : Nat := s.n | ||
|
||
@[deprecated "`SomeStructure.foo7` has been deprecated; please use `SomeStructure.foo1` instead."] | ||
def SomeStructure.foo7 (s : SomeStructure) : Nat := s.n | ||
|
||
/-- A docstring. -/ | ||
@[deprecated "`SomeStructure.foo8` has been deprecated; please use `SomeStructure.foo1` instead."] | ||
def SomeStructure.foo8 (s : SomeStructure) : Nat := s.n | ||
|
||
example := SomeStructure.foo -- Completion items with a deprecation tag and a deprecation message | ||
--^ textDocument/completion |
96 changes: 96 additions & 0 deletions
96
tests/lean/interactive/completionDeprecation.lean.expected.out
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,96 @@ | ||
{"textDocument": {"uri": "file:///completionDeprecation.lean"}, | ||
"position": {"line": 25, "character": 28}} | ||
{"items": | ||
[{"sortText": "0", | ||
"label": "foo1", | ||
"kind": 3, | ||
"data": | ||
{"params": | ||
{"textDocument": {"uri": "file:///completionDeprecation.lean"}, | ||
"position": {"line": 25, "character": 28}}, | ||
"id": {"const": {"declName": "SomeStructure.foo1"}}}}, | ||
{"sortText": "1", | ||
"label": "foo2", | ||
"kind": 3, | ||
"documentation": {"value": "A docstring. ", "kind": "markdown"}, | ||
"data": | ||
{"params": | ||
{"textDocument": {"uri": "file:///completionDeprecation.lean"}, | ||
"position": {"line": 25, "character": 28}}, | ||
"id": {"const": {"declName": "SomeStructure.foo2"}}}}, | ||
{"tags": [1], | ||
"sortText": "2", | ||
"label": "foo3", | ||
"kind": 3, | ||
"documentation": | ||
{"value": "`SomeStructure.foo3` has been deprecated.", "kind": "markdown"}, | ||
"data": | ||
{"params": | ||
{"textDocument": {"uri": "file:///completionDeprecation.lean"}, | ||
"position": {"line": 25, "character": 28}}, | ||
"id": {"const": {"declName": "SomeStructure.foo3"}}}}, | ||
{"tags": [1], | ||
"sortText": "3", | ||
"label": "foo4", | ||
"kind": 3, | ||
"documentation": | ||
{"value": "`SomeStructure.foo4` has been deprecated.\n\nA docstring. ", | ||
"kind": "markdown"}, | ||
"data": | ||
{"params": | ||
{"textDocument": {"uri": "file:///completionDeprecation.lean"}, | ||
"position": {"line": 25, "character": 28}}, | ||
"id": {"const": {"declName": "SomeStructure.foo4"}}}}, | ||
{"tags": [1], | ||
"sortText": "4", | ||
"label": "foo5", | ||
"kind": 3, | ||
"documentation": | ||
{"value": | ||
"`SomeStructure.foo5` has been deprecated, use `SomeStructure.foo1` instead.", | ||
"kind": "markdown"}, | ||
"data": | ||
{"params": | ||
{"textDocument": {"uri": "file:///completionDeprecation.lean"}, | ||
"position": {"line": 25, "character": 28}}, | ||
"id": {"const": {"declName": "SomeStructure.foo5"}}}}, | ||
{"tags": [1], | ||
"sortText": "5", | ||
"label": "foo6", | ||
"kind": 3, | ||
"documentation": | ||
{"value": | ||
"`SomeStructure.foo6` has been deprecated, use `SomeStructure.foo1` instead.\n\nA docstring. ", | ||
"kind": "markdown"}, | ||
"data": | ||
{"params": | ||
{"textDocument": {"uri": "file:///completionDeprecation.lean"}, | ||
"position": {"line": 25, "character": 28}}, | ||
"id": {"const": {"declName": "SomeStructure.foo6"}}}}, | ||
{"tags": [1], | ||
"sortText": "6", | ||
"label": "foo7", | ||
"kind": 3, | ||
"documentation": | ||
{"value": | ||
"`SomeStructure.foo7` has been deprecated; please use `SomeStructure.foo1` instead.", | ||
"kind": "markdown"}, | ||
"data": | ||
{"params": | ||
{"textDocument": {"uri": "file:///completionDeprecation.lean"}, | ||
"position": {"line": 25, "character": 28}}, | ||
"id": {"const": {"declName": "SomeStructure.foo7"}}}}, | ||
{"tags": [1], | ||
"sortText": "7", | ||
"label": "foo8", | ||
"kind": 3, | ||
"documentation": | ||
{"value": | ||
"`SomeStructure.foo8` has been deprecated; please use `SomeStructure.foo1` instead.\n\nA docstring. ", | ||
"kind": "markdown"}, | ||
"data": | ||
{"params": | ||
{"textDocument": {"uri": "file:///completionDeprecation.lean"}, | ||
"position": {"line": 25, "character": 28}}, | ||
"id": {"const": {"declName": "SomeStructure.foo8"}}}}], | ||
"isIncomplete": true} |