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

Sort @deprecated completions lower than others #43816

Closed
wants to merge 1 commit into from
Closed

Sort @deprecated completions lower than others #43816

wants to merge 1 commit into from

Conversation

sangxxh
Copy link
Contributor

@sangxxh sangxxh commented Apr 25, 2021

Fixes #43796

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Apr 25, 2021
Copy link
Contributor Author

@sangxxh sangxxh left a comment

Choose a reason for hiding this comment

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

Sorry, where can I write tests for the session?

I've tried verify.completions but it's not testing this method in Session.

@sangxxh
Copy link
Contributor Author

sangxxh commented Apr 25, 2021

There's "something" in VSCode that's still re-ordering the suggestions. Debugging https://github.com/microsoft/vscode/tree/main/extensions/typescript-language-features shows that the server response looks correct:

2021-04-25 21_36_36-

But the suggestions shown to the UI differs, b is not at bottom:

2021-04-25 21_39_47-deprecated ts - 43172-generator-destructuring-no-error-implicit-any-type - Code

Test Code:
const foo = {
  /**
   * @deprecated
   */
  b: 'b',
  a: 'a',
  c: 'c',
};

foo.
Trace when trigger completions in VSCode
[Trace  - 11:25:06.7] <semantic> Sending request: quickinfo (36). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "d:/typescript/deprecated.ts",
    "line": 10,
    "offset": 5
}
[Trace  - 11:25:06.7] <semantic> Response received: quickinfo (36). Request took 0 ms. Success: false . Message: No content available.
[Trace  - 11:25:06.309] <semantic> Sending request: completionInfo (37). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "d:/typescript/deprecated.ts",
    "line": 10,
    "offset": 5,
    "includeExternalModuleExports": true,
    "includeInsertTextCompletions": true
}
[Trace  - 11:25:06.314] <semantic> Response received: completionInfo (37). Request took 5 ms. Success: true 
Result: {
    "isGlobalCompletion": false,
    "isMemberCompletion": true,
    "isNewIdentifierLocation": false,
    "entries": [
        {
            "name": "a",
            "kind": "property",
            "kindModifiers": "",
            "sortText": "1"
        },
        {
            "name": "c",
            "kind": "property",
            "kindModifiers": "",
            "sortText": "1"
        },
        {
            "name": "b",
            "kind": "property",
            "kindModifiers": "deprecated",
            "sortText": "1"
        }
    ]
}
[Trace  - 11:25:06.333] <semantic> Sending request: completionEntryDetails (38). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "d:/typescript/deprecated.ts",
    "line": 10,
    "offset": 5,
    "entryNames": [
        "a"
    ]
}
[Trace  - 11:25:06.335] <semantic> Response received: completionEntryDetails (38). Request took 3 ms. Success: true 
Result: [
    {
        "name": "a",
        "kindModifiers": "",
        "kind": "property",
        "displayParts": [
            {
                "text": "(",
                "kind": "punctuation"
            },
            {
                "text": "property",
                "kind": "text"
            },
            {
                "text": ")",
                "kind": "punctuation"
            },
            {
                "text": " ",
                "kind": "space"
            },
            {
                "text": "a",
                "kind": "propertyName"
            },
            {
                "text": ":",
                "kind": "punctuation"
            },
            {
                "text": " ",
                "kind": "space"
            },
            {
                "text": "string",
                "kind": "keyword"
            }
        ],
        "documentation": [],
        "tags": []
    }
]

@Kingwl
Copy link
Contributor

Kingwl commented Apr 26, 2021

May we add more behavior about the order of completion item?

We have #40079 (to fix #40078) sometime ago.

It's seems very helpful for user experience.

BTW: No need to do in this PR.

/cc: @DanielRosenwasser @RyanCavanaugh

Copy link
Member

@sheetalkamat sheetalkamat left a comment

Choose a reason for hiding this comment

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

If the issue is committed (its still suggestion and not scheduled for milestone nor in backlog), this isn't right way to fix but instead to update sortText property with new enum value.

@DanielRosenwasser
Copy link
Member

CC @uniqueiniquity @jessetrinity

@typescript-bot typescript-bot added For Milestone Bug PRs that fix a bug with a specific milestone and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Apr 29, 2021
@sheetalkamat
Copy link
Member

There seems to be another PR #43880 doing this same thing

@sangxxh
Copy link
Contributor Author

sangxxh commented Apr 29, 2021

Ah, do we create overriding PRs just like that 😬

@sangxxh sangxxh deleted the issue/43796-sort-deprecated-completions-lower-than-others branch April 29, 2021 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Sort @deprecated completions lower than others
5 participants