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

The position of inlay hint parameter is wrong when using at or operator[] to access a container's element #9741

Closed
zhiyiYo opened this issue Aug 16, 2022 · 7 comments
Labels
bug Feature: Inlay Hint An issue related to inlay hints for declarations and parameters. fixed Check the Milestone for the release in which the fix is or will be available. Language Service verified Bug has been reproduced Visual Studio Inherited from Visual Studio
Milestone

Comments

@zhiyiYo
Copy link

zhiyiYo commented Aug 16, 2022

Environment

  • OS and version: Windows 11 22621.382
  • VS Code: 1.70.1
  • C/C++ extension: v1.12.1 pre-released

Bug Summary and Steps to Reproduce

Bug Summary:
The position of inlay hints is wrong.
image

Expected behavior

c: should be in front of s_[0]

Code sample and Logs

#include <iostream>
#include <string>
using namespace std;

int main(int argc, char const *argv[])
{
    string s = "hello";
    string s_ = "world";
    s.push_back(s_[0]);
    return 0;
}
@michelleangela michelleangela self-assigned this Aug 16, 2022
@michelleangela michelleangela added Language Service Visual Studio Inherited from Visual Studio Feature: Inlay Hint An issue related to inlay hints for declarations and parameters. labels Aug 16, 2022
@michelleangela michelleangela changed the title The position of inlay hints is wrong The position of inlay hint parameter is wrong when using at or operator[] to access a container's element Aug 16, 2022
@michelleangela
Copy link
Contributor

Other repro cases:

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char const* argv[])
{
    string resultString = "";
    string myString = "abc";
    vector<char> charsVector = { 'a', 'b' };
    char charsArray[] = { 'a', 'b' };

    vector<int> numVector = { 0, 1 };
    int numArray[] = { 0, 1 };
    vector<int> resultNum = {};

    // Parameter hint "Ch" should be displayed in front of "charsVector"
    // instead of in front of the container's accessor.
    resultString.push_back(charsVector.at(0));
    resultString.push_back(charsVector[0]);
    
    // Parameter hint "Ch" should be displayed in front of "myString"
    // instead of in front of the container's accessor.
    resultString.push_back(myString.at(0));
    resultString.push_back(myString[0]);

    // Parameter hint is displayed as expected for these examples
    resultString.push_back(charsArray[0]);
    resultNum.push_back(numArray[0]);
    resultNum.push_back(numVector[0]);
    resultNum.push_back(numVector.at(0));

    return 0;
}

image

@michelleangela michelleangela added bug verified Bug has been reproduced labels Aug 16, 2022
@michelleangela
Copy link
Contributor

@zhiyiYo
Thank you for reporting this issue. Our extension's IntelliSense code base which has this bug is shared with Visual Studio, so I created a feedback ticket against Visual Studio.

Please upvote the issue at https://developercommunity.visualstudio.com/t/C-inline-hint-parameter----position-of/10122247?port=1026&fsid=c4e872fe-0e2c-4bdf-aa14-c26fe321ff59&entry=problem

@zhiyiYo
Copy link
Author

zhiyiYo commented Aug 17, 2022

@michelleangela
I have voted for this issue🙂

@sean-mcmanus sean-mcmanus added this to the 1.13.2 milestone Sep 29, 2022
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Sep 29, 2022
@sean-mcmanus sean-mcmanus modified the milestones: 1.13.2, 1.13.3 Oct 4, 2022
@michelleangela
Copy link
Contributor

Verified fixed for 1.13.2

@michelleangela michelleangela removed their assignment Oct 5, 2022
@sean-mcmanus
Copy link
Contributor

@michelleangela What? I don't believe the fix made it in yet. The plan was for 1.13.3.

@sean-mcmanus sean-mcmanus removed the fixed Check the Milestone for the release in which the fix is or will be available. label Oct 5, 2022
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Oct 5, 2022
@sean-mcmanus sean-mcmanus modified the milestones: 1.13.3, 1.13.2 Oct 5, 2022
@sean-mcmanus
Copy link
Contributor

@michelleangela Ah, I see now -- it is fixed. I was looking at the follow up PR which is related.

@sean-mcmanus
Copy link
Contributor

@zhiyiYo zhiyiYo closed this as completed Oct 6, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Feature: Inlay Hint An issue related to inlay hints for declarations and parameters. fixed Check the Milestone for the release in which the fix is or will be available. Language Service verified Bug has been reproduced Visual Studio Inherited from Visual Studio
Projects
None yet
Development

No branches or pull requests

3 participants