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

add more information to quickinfo for imported symbols #19489

Merged
merged 1 commit into from
Jan 8, 2018

Conversation

jwbay
Copy link
Contributor

@jwbay jwbay commented Oct 26, 2017

Fixes #5515

I took the approach here, more or less -- #5515 (comment). We basically print out the root symbol meanings above the import, but with the alias name where it makes sense.

The result:
image

I tried to follow prior art on how things are displayed. This is the current behavior in master for quickinfo on a resolved signature of an imported alias.
image

@mhegazy
Copy link
Contributor

mhegazy commented Oct 30, 2017

@DanielRosenwasser and @bowdenk7 can i get your input on this?

@jwbay jwbay force-pushed the import-quickinfo branch 2 times, most recently from 27f02d9 to d268886 Compare November 4, 2017 01:59
verify.baselineQuickInfo();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was a bit difficult to decipher, so I swapped it for a baseline. Hope that's alright. If it helps, this is the diff for it against master.

diff --git a/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline b/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline
index 6c2047f..c476aba 100644
--- a/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline
+++ b/tests/baselines/reference/quickInfoDisplayPartsInternalModuleAlias.baseline
@@ -1,434 +1,722 @@
 [
   {
     "marker": {
       "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsInternalModuleAlias.ts",
       "position": 66
     },
     "quickInfo": {
       "kind": "alias",
       "kindModifiers": "",
       "textSpan": {
         "start": 66,
         "length": 2
       },
       "displayParts": [
         {
+          "text": "(",
+          "kind": "punctuation"
+        },
+        {
+          "text": "alias",
+          "kind": "text"
+        },
+        {
+          "text": ")",
+          "kind": "punctuation"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "namespace",
+          "kind": "keyword"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "a1",
+          "kind": "aliasName"
+        },
+        {
+          "text": "\n",
+          "kind": "lineBreak"
+        },
+        {
           "text": "import",
           "kind": "keyword"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "a1",
           "kind": "aliasName"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "=",
           "kind": "operator"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m",
           "kind": "moduleName"
         }
       ],
       "documentation": [],
       "tags": []
     }
   },
   {
     "marker": {
       "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsInternalModuleAlias.ts",
       "position": 82
     },
     "quickInfo": {
       "kind": "alias",
       "kindModifiers": "",
       "textSpan": {
         "start": 82,
         "length": 2
       },
       "displayParts": [
         {
+          "text": "(",
+          "kind": "punctuation"
+        },
+        {
+          "text": "alias",
+          "kind": "text"
+        },
+        {
+          "text": ")",
+          "kind": "punctuation"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "namespace",
+          "kind": "keyword"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "a1",
+          "kind": "aliasName"
+        },
+        {
+          "text": "\n",
+          "kind": "lineBreak"
+        },
+        {
           "text": "import",
           "kind": "keyword"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "a1",
           "kind": "aliasName"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "=",
           "kind": "operator"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m",
           "kind": "moduleName"
         }
       ],
       "documentation": [],
       "tags": []
     }
   },
   {
     "marker": {
       "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsInternalModuleAlias.ts",
       "position": 104
     },
     "quickInfo": {
       "kind": "alias",
       "kindModifiers": "",
       "textSpan": {
         "start": 104,
         "length": 2
       },
       "displayParts": [
         {
+          "text": "(",
+          "kind": "punctuation"
+        },
+        {
+          "text": "alias",
+          "kind": "text"
+        },
+        {
+          "text": ")",
+          "kind": "punctuation"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "namespace",
+          "kind": "keyword"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "a2",
+          "kind": "aliasName"
+        },
+        {
+          "text": "\n",
+          "kind": "lineBreak"
+        },
+        {
           "text": "import",
           "kind": "keyword"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "a2",
           "kind": "aliasName"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "=",
           "kind": "operator"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m",
           "kind": "moduleName"
         },
         {
           "text": ".",
           "kind": "punctuation"
         },
         {
           "text": "m1",
           "kind": "moduleName"
         }
       ],
       "documentation": [],
       "tags": []
     }
   },
   {
     "marker": {
       "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsInternalModuleAlias.ts",
       "position": 123
     },
     "quickInfo": {
       "kind": "alias",
       "kindModifiers": "",
       "textSpan": {
         "start": 123,
         "length": 2
       },
       "displayParts": [
         {
+          "text": "(",
+          "kind": "punctuation"
+        },
+        {
+          "text": "alias",
+          "kind": "text"
+        },
+        {
+          "text": ")",
+          "kind": "punctuation"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "namespace",
+          "kind": "keyword"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "a2",
+          "kind": "aliasName"
+        },
+        {
+          "text": "\n",
+          "kind": "lineBreak"
+        },
+        {
           "text": "import",
           "kind": "keyword"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "a2",
           "kind": "aliasName"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "=",
           "kind": "operator"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m",
           "kind": "moduleName"
         },
         {
           "text": ".",
           "kind": "punctuation"
         },
         {
           "text": "m1",
           "kind": "moduleName"
         }
       ],
       "documentation": [],
       "tags": []
     }
   },
   {
     "marker": {
       "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsInternalModuleAlias.ts",
       "position": 149
     },
     "quickInfo": {
       "kind": "alias",
       "kindModifiers": "export",
       "textSpan": {
         "start": 149,
         "length": 2
       },
       "displayParts": [
         {
+          "text": "(",
+          "kind": "punctuation"
+        },
+        {
+          "text": "alias",
+          "kind": "text"
+        },
+        {
+          "text": ")",
+          "kind": "punctuation"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "namespace",
+          "kind": "keyword"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "m2",
+          "kind": "moduleName"
+        },
+        {
+          "text": ".",
+          "kind": "punctuation"
+        },
+        {
+          "text": "a3",
+          "kind": "aliasName"
+        },
+        {
+          "text": "\n",
+          "kind": "lineBreak"
+        },
+        {
           "text": "import",
           "kind": "keyword"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m2",
           "kind": "moduleName"
         },
         {
           "text": ".",
           "kind": "punctuation"
         },
         {
           "text": "a3",
           "kind": "aliasName"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "=",
           "kind": "operator"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m",
           "kind": "moduleName"
         }
       ],
       "documentation": [],
       "tags": []
     }
   },
   {
     "marker": {
       "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsInternalModuleAlias.ts",
       "position": 165
     },
     "quickInfo": {
       "kind": "alias",
       "kindModifiers": "export",
       "textSpan": {
         "start": 165,
         "length": 2
       },
       "displayParts": [
         {
+          "text": "(",
+          "kind": "punctuation"
+        },
+        {
+          "text": "alias",
+          "kind": "text"
+        },
+        {
+          "text": ")",
+          "kind": "punctuation"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "namespace",
+          "kind": "keyword"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "m2",
+          "kind": "moduleName"
+        },
+        {
+          "text": ".",
+          "kind": "punctuation"
+        },
+        {
+          "text": "a3",
+          "kind": "aliasName"
+        },
+        {
+          "text": "\n",
+          "kind": "lineBreak"
+        },
+        {
           "text": "import",
           "kind": "keyword"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m2",
           "kind": "moduleName"
         },
         {
           "text": ".",
           "kind": "punctuation"
         },
         {
           "text": "a3",
           "kind": "aliasName"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "=",
           "kind": "operator"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m",
           "kind": "moduleName"
         }
       ],
       "documentation": [],
       "tags": []
     }
   },
   {
     "marker": {
       "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsInternalModuleAlias.ts",
       "position": 194
     },
     "quickInfo": {
       "kind": "alias",
       "kindModifiers": "export",
       "textSpan": {
         "start": 194,
         "length": 2
       },
       "displayParts": [
         {
+          "text": "(",
+          "kind": "punctuation"
+        },
+        {
+          "text": "alias",
+          "kind": "text"
+        },
+        {
+          "text": ")",
+          "kind": "punctuation"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "namespace",
+          "kind": "keyword"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "m2",
+          "kind": "moduleName"
+        },
+        {
+          "text": ".",
+          "kind": "punctuation"
+        },
+        {
+          "text": "a4",
+          "kind": "aliasName"
+        },
+        {
+          "text": "\n",
+          "kind": "lineBreak"
+        },
+        {
           "text": "import",
           "kind": "keyword"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m2",
           "kind": "moduleName"
         },
         {
           "text": ".",
           "kind": "punctuation"
         },
         {
           "text": "a4",
           "kind": "aliasName"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "=",
           "kind": "operator"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m",
           "kind": "moduleName"
         },
         {
           "text": ".",
           "kind": "punctuation"
         },
         {
           "text": "m1",
           "kind": "moduleName"
         }
       ],
       "documentation": [],
       "tags": []
     }
   },
   {
     "marker": {
       "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsInternalModuleAlias.ts",
       "position": 213
     },
     "quickInfo": {
       "kind": "alias",
       "kindModifiers": "export",
       "textSpan": {
         "start": 213,
         "length": 2
       },
       "displayParts": [
         {
+          "text": "(",
+          "kind": "punctuation"
+        },
+        {
+          "text": "alias",
+          "kind": "text"
+        },
+        {
+          "text": ")",
+          "kind": "punctuation"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "namespace",
+          "kind": "keyword"
+        },
+        {
+          "text": " ",
+          "kind": "space"
+        },
+        {
+          "text": "m2",
+          "kind": "moduleName"
+        },
+        {
+          "text": ".",
+          "kind": "punctuation"
+        },
+        {
+          "text": "a4",
+          "kind": "aliasName"
+        },
+        {
+          "text": "\n",
+          "kind": "lineBreak"
+        },
+        {
           "text": "import",
           "kind": "keyword"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m2",
           "kind": "moduleName"
         },
         {
           "text": ".",
           "kind": "punctuation"
         },
         {
           "text": "a4",
           "kind": "aliasName"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "=",
           "kind": "operator"
         },
         {
           "text": " ",
           "kind": "space"
         },
         {
           "text": "m",
           "kind": "moduleName"
         },
         {
           "text": ".",
           "kind": "punctuation"
         },
         {
           "text": "m1",
           "kind": "moduleName"
         }
       ],
       "documentation": [],
       "tags": []
     }
   }
 ]

@DanielRosenwasser
Copy link
Member

Sorry for the delay! I think it's an improvement, but I could see where it'd go wrong for much more complex types. That said, I don't think that should block the change.

@bowdenk7
Copy link

👍 from me

@jwbay jwbay force-pushed the import-quickinfo branch from 00faeac to 56fc112 Compare January 4, 2018 06:17
@mhegazy
Copy link
Contributor

mhegazy commented Jan 8, 2018

@jwbay sorry for the delay. can you please refresh the PR, and address the failing CI test?

@mhegazy
Copy link
Contributor

mhegazy commented Jan 8, 2018

merged manually. thanks.

@mhegazy mhegazy merged commit 56fc112 into microsoft:master Jan 8, 2018
@jwbay jwbay deleted the import-quickinfo branch January 8, 2018 23:26
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import aliases have poor quick-info descriptions
4 participants