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

"Parameter hint" problem #902

Closed
lh123 opened this issue Jul 20, 2017 · 15 comments
Closed

"Parameter hint" problem #902

lh123 opened this issue Jul 20, 2017 · 15 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service

Comments

@lh123
Copy link
Contributor

lh123 commented Jul 20, 2017

  • VsCode Version : 1.14.1
  • Extension Version:0.12.1
  • Os : Win10 64Bit
  • gcc : MinGW-W64(5.3.0)
  1. Parameter hints can not be triggered when direct initialization is used。
  2. Parameter hints can not be triggered again in parentheses
#include <iostream>
#include "lib/people.h"
using namespace std;
int main() {
    People p1("test",10);//Parameter hints can not be triggered when direct initialization is used。
    People *p2 = new People("test",10);//There are parameter hints
    People *p3 = new People("test",);//Parameter hints can not be triggered again in parentheses
    cin.get();
    return 0;
}
  1. Automatic completion without context analysis, such as the prompt "cout" but using namespace std has been commented out

image

Sorry my English is very bad

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Jul 20, 2017

As a workaround, you can get parameter hints a 2nd time by doing Ctrl+Shift+Space after the opening (, for the ("test", ) case. Parameter hints with direct initialization doesn't even work in VS 2017, but it works with the {} initialization syntax (we still don't). We don't yet have the semantic aware completion for non-prefixed words (only after -> . ::).

@lh123
Copy link
Contributor Author

lh123 commented Jul 21, 2017

@sean-mcmanus Thank you for your answer
But I found that only re-enter the left parenthesis to re-pop up the parameter prompt, and Ctrl + Shift + Space in the brackets can not trigger the parameter prompt again.

#819 also has the same problem

Another question
When I #include <windows.h> in the file, Intellisense will produce many errors

  • my code
#include <windows.h>
#include <iostream>

int main(){
    return 0;
}

image

  • c_cpp_properties.json
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceRoot}",
                "D:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/include",
                "D:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/include-fixed",
                "D:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/include",
                "D:/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++",
                "D:/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32",
                "D:/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/backward"
            ],
            "defines": [
                "__GNUC__=5",
                "__cdecl=__attribute__((__cdecl__))"
            ],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "${workspaceRoot}",
                    "D:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/include",
                    "D:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/include-fixed",
                    "D:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/include",
                    "D:/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++",
                    "D:/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32",
                    "D:/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/backward"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 2
}

How should I solve this problem?

@sean-mcmanus
Copy link
Collaborator

I don't think windows.h is intended to be compiled with the clang-x64 compiler. I assume it requires the msvc-x64 intelliSenseMode set. I thought mingw was meant for compiling Linux code and not Windows OS code.

@bobbrow
Copy link
Member

bobbrow commented Jul 21, 2017

I can take a look at this. windows.h ships with MinGW and you can create Windows apps with it.

@lh123
Copy link
Contributor Author

lh123 commented Jul 22, 2017

@sean-mcmanus Thank you for your answer, but I can not fully understand what you said.
"Windows.h" is the file that comes with MinGW-W64, and I can use the "g ++ main.cpp -o main" command to complete the compilation.
When I set intelliSenseMode to msvc-x64 mode, these errors disappear, but msvc-x64 does not work on MinGW.

@sean-mcmanus
Copy link
Collaborator

@lh123 Yeah, ignore what I said. Bob is more familiar with MinGW, so he'll investigate.

@lh123
Copy link
Contributor Author

lh123 commented Aug 27, 2017

@bobbrow In the latest version, I found that adding __stdcall=__attribute__((__stdcall__)) in the definition, IntelliSence can handle windows.h correctly.

@bobbrow
Copy link
Member

bobbrow commented Aug 28, 2017

I'm so sorry I dropped the ball on this. We've seen a large increase in the number of issues reported per week as more people start using the extension and it's getting harder to keep track of them all.

@sean-mcmanus
Copy link
Collaborator

So should the MinGW docs be updated to include the __stdcall definition? https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/MinGW.md

@lh123
Copy link
Contributor Author

lh123 commented Sep 12, 2017

@sean-mcmanus If this is correct, I think the MinGW docs should be updated

@bobbrow
Copy link
Member

bobbrow commented Sep 13, 2017

I was starting to look at this before I took a few days off. MinGW-w64 seems to behave differently than my other MinGW installation (which defines __stdcall in the Windows headers without manual intervention by the c_cpp_properties.json file).

I'm still looking at this when I'm not getting pulled in to other issues, but I haven't settled on a final answer yet. We may need to have some footnotes for the different distributions of MinGW.

@lh123
Copy link
Contributor Author

lh123 commented Nov 4, 2017

@bobbrow I think you can use the g++ -dM -E - /dev/null command to automate the addition of some macro definitions.

@sean-mcmanus
Copy link
Collaborator

@lh123 Thanks for the info. Our pending update will try to get the default includePath from the compiler, but the defines might not be till a later update.

@xahon
Copy link

xahon commented Nov 9, 2017

Parameter hint works only once when i open paren.
If i esc currently opened parameter hint infobox and press ctrl+shift+space nothing happens.

So i noticed that smart pointer constructor and their make don't show object constructor parameters.
std::make_shared<int>(/* parameter hint will show shared_ptr contructor hints instead of int's */ - so may be it's right by design but i think it would be better if object's parameters will be shown

@bobbrow bobbrow added the fixed Check the Milestone for the release in which the fix is or will be available. label Nov 13, 2017
@bobbrow
Copy link
Member

bobbrow commented Nov 28, 2017

This should be fixed with version 0.14.3

@bobbrow bobbrow closed this as completed Nov 28, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

4 participants