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

WSL/Ubuntu : Autocomplete feature & Quick info (tooltips) feature do not work. #1377

Closed
sus007 opened this issue Dec 27, 2017 · 26 comments
Closed
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@sus007
Copy link

sus007 commented Dec 27, 2017

  • Operating System and version: Windows 10 Pro Insider Preview - 1709
  • VS Code version:
    • Version 1.20.0-insider
    • Commit f9115349ef09cfef2bed669680d10ac58b490dce
    • Date 2017-12-21T16:36:58.030Z
    • Shell 1.7.9
    • Renderer 58.0.3029.110
    • Node 7.9.0
    • Architecture x64
  • C/C++ extension version: Version 0.14.5: December 18, 2017

Hello, I am a bash on Ubuntu on Windows user. And I've had some problems while I was programming in C++. I've already followed the guidelines provided in the documentation and my linter & debugger is doing fine but the autocomplete feature doesn't appear at all(as seen in the GIF) How can I fix this? Do I need to make additional changes in my launch.json file or other configuration file ? 🙁

image

@sus007
Copy link
Author

sus007 commented Dec 27, 2017

@bobbrow @sean-mcmanus @CoenraadS Please, have a look at this issue.

@sean-mcmanus
Copy link
Collaborator

We should be autocompleting when the # is used and also on the using/namespace keywords. Is your "C_Cpp.autocomplete" set to "Disabled"?

@sean-mcmanus sean-mcmanus added Language Service more info needed The issue report is not actionable in its current state labels Dec 27, 2017
@sus007
Copy link
Author

sus007 commented Dec 28, 2017

@sean-mcmanus No, sir I've thoroughly gone through such minor settings and everything seems OK to me. VSCode doesn't show a single hint(dropdown options) while typing. C_Cpp.auocomplete is on Default mode and I copied the exact same configuration from the documentation for my c_cpp_properties.json file. I've provided my VSCode's configuration below:

C/C++ User Configuration

  • "C_Cpp.autocomplete": "Default",

  • "C_Cpp.clang_format_fallbackStyle": "Visual Studio",

  • "C_Cpp.clang_format_path": null,

  • "C_Cpp.clang_format_sortIncludes": null,

  • "C_Cpp.clang_format_style": "file",

  • "C_Cpp.errorSquiggles": "Enabled",

  • "C_Cpp.formatting": "Default",

  • "C_Cpp.intelliSenseEngine": "Default",

  • "C_Cpp.intelliSenseEngineFallback": "Enabled",

  • "C_Cpp.loggingLevel": "Error",

  • "C_Cpp.navigation.length": 60,

@sean-mcmanus
Copy link
Collaborator

I assume your workspace settings don't overwrite those user settings, right? Are you doing an open folder or open file? The "include" keyword that comes after the # should always be auto-completed unless the browse database is failing to get created -- can you set your databaseFilename in c_cpp_properties.json so something like ${workspaceRoot}/.vscode/browse.db and verify that the file is created? Another explanation is that the main input thread might be blocked -- do you see a flame or database icon in the bottom right? What happens if you change the intelliSenseEngine to "Tag Parser"?

@sus007
Copy link
Author

sus007 commented Dec 28, 2017

@sean-mcmanus
It started displaying dropdown options/hints when I changed the intelliSenseEngine to Tag Parser, but still I want to utilize context-aware autocompletion feature which is provided by the Default engine. And as the documentation states that the Default engine is in preview mode, could that be the issue? How much different is the Tag Parser engine from the Default one ? What specific features of the Default Engine will I not be able to use while using Tag Parser ?

Also, despite having enabled "C_Cpp.intelliSenseEngineFallback" why didn't VSCode automatically select Tag Parser and why did I have to manually set the engine?

"Tag Parser" provides "fuzzy" results that are not context-aware. "Default" provides context-aware results and is in preview mode - member list, hover tooltips, and error squiggles are currently implemented. Features not yet implemented in the new default engine will use the tag parser engine instead.

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Dec 28, 2017

The keyword completion code is shared by both the Tag Parser and Default intelliSense engine, so the results there should be the same unless the IntelliSense code is blocking the main thread for some reason, causing the completion code to not execute at all. It's recommended to use the Default intelliSenseEngine if possible (the includePath and define settings in c_cpp_properties.json might need to be configured correctly though). The Tag Parser fallback will only be used if it fails to find #include references in a file. The "Default" version adds error squiggles, better completion, better hover, better signatureHelp, better reference highlighting, but Go to Definition is still provided by the Tag Parser. When using the Default engine, is the flame in the bottom right stuck?

@sus007
Copy link
Author

sus007 commented Dec 28, 2017

@sean-mcmanus I've copied the exact same configuration for c_cpp_properties.json from the suggested documentation. No, I don't see any 🔥 icon in the bottom right of the bar. I only see an additional database icon which says Discovering open files .... Parsing files.
image
I understand there are similar issues in GitHub where user sees a RED FLAME icon but, I don't think my case's like other similar issues in GitHub about Infinite looping and mass CPU consumption since I've also monitored the activity in task manager and the memory-CPU consumption seems fine to me.
image

@sus007
Copy link
Author

sus007 commented Dec 28, 2017

@sean-mcmanus I've just discovered this issue in the C/C++ extension's log while using the Default engine. This might help you to determine the issue.
image

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Dec 28, 2017

Yeah, it's not able to start the Microsoft.VSCode.Cpp.IntelliSense.Msvc.exe process. Does the file exist in the Users/<user>/.vscode/extensions/ms-vscode.cpptools-<version>/bin folder? Are you able to run it from the command line (it should silently exit)? Do you have any dangling processes running? I don't know what could prevent that process from starting on Windows.

@sus007
Copy link
Author

sus007 commented Dec 28, 2017

These are all the files in the location, and the specified application Microsoft.VSCode.Cpp.IntelliSense.Msvc.exe does exist, as you can see.
image
When trying to run the application externally(from the Explorer window), a command window appeared for a split second and nothing happened.
I do not have any other dangling processes running that can possibly obstruct the process, to the best of my knowledge. Could you provide me some examples for the apps/processes that could be causing this ?

@sean-mcmanus
Copy link
Collaborator

Dangling Microsoft.VSCode.Cpp processes (i.e. still alive after closing VS Code). Everything looks good. I don't think we've ever encountered this issue before on Windows. Could the Insiders build of Windows have something that breaks us? If you were on Linux I'd say to make sure the file has executable permissions. Maybe @bobbrow will have some suggestions when he gets back next week. We may need to check the GetLastError result after calling CreateProcess and add better logging.

@sus007
Copy link
Author

sus007 commented Dec 28, 2017

I've also tried the following conditions,

  • Reinstalled the C/C++ Extension & redownloaded all the packages for the extension by deleting the old one.
  • Disabled all the other packages with only C/C++ extension enabled.
  • Closed all the other significant apps/process running previously.

but still kept getting the same error i.e

Failed to create IntelliSense client

Can't create intellisense client for D:\folder\main.cpp

Failed to spawn IntelliSense process: Unable to start child process!

Also, there were no dangling apps/processes running in the background after the VSCode was exited.

I don't think an anti-malware application (Malwarebytes or the Windows Defender itself) could be causing this ?

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Dec 29, 2017

Have you tried running VS Code as an admin? Does your installation directory (the .vscode/extensions one) have any non-ASCII characters in it? We had some problems with that previously but they got fixed. You might try running Process Monitor (https://docs.microsoft.com/en-us/sysinternals/downloads/procmon ) filtering by the Microsoft.VSCode.CPP.IntelliSense.Msvc.exe Process Name (or maybe on the Extension.exe process since maybe it will show the CreatProcess error code on that process).

@sean-mcmanus
Copy link
Collaborator

Yeah, you should be able to use Process Monitor on the Extension.exe process to see the error code from the Operation "Process Create". I don't know if the error code it shows will be useful though.

@sus007
Copy link
Author

sus007 commented Dec 29, 2017

Running VSCode as an admin didn't work either. My absolute path of the installation directory however has a space between my name & surname, but no non-ASCII characters in it. I recall me having same issue during my Android Studio installation which required me to install Android SDK in the path with no space between name. Can you confirm that space isn't the issue so that I won't have to reinstall VSCode again into different location ?

@sean-mcmanus
Copy link
Collaborator

Sure, I'll try testing it with a space in the user name...

@sean-mcmanus
Copy link
Collaborator

It works with a space in the user name. We haven't received any reports like this yet, but it's possible users are hitting it without realizing it, so we'll try to investigate more...

@sus007
Copy link
Author

sus007 commented Dec 29, 2017

Do update this thread as soon as you discover something helpful and I'll also try my best to figure out the issue myself too.

@sean-mcmanus sean-mcmanus removed the more info needed The issue report is not actionable in its current state label Dec 29, 2017
@bobbrow
Copy link
Member

bobbrow commented Jan 2, 2018

"Unable to start child process!" is the error that I return when the CreateProcess API call fails. Perhaps I can add some logging for the inputs to that API.

@starkblitz
Copy link

I am getting the same error.

Failed to spawn IntelliSense process: Unable to start child process!
Failed to create IntelliSense client. Can't create intellisense client

@sean-mcmanus
Copy link
Collaborator

@starkblitz What version of the C/C++ extension are you using? Can you provide more repro details?

@starkblitz
Copy link

starkblitz commented Feb 1, 2019

Here are the version info

VSCode:                     1.30.2       
C/C++ extension version:    0.21.0
Windows Version:            64-bit, Wndows 10 1809, Build Number 17763.292

Here is the output file of the extension:

initialized
workspace/didChangeConfiguration
IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
Autocomplete is enabled.
Error squiggles are enabled.
File exclude: **/.git
File exclude: **/.svn
File exclude: **/.hg
File exclude: **/CVS
File exclude: **/.DS_Store
File exclude: **/.vscode
Search exclude: **/node_modules
Search exclude: **/bower_components
Search exclude: **/.vscode
textDocument/didOpen
cpptools/queryCompilerDefaults
Attempting to get defaults from compiler found on the machine: 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe'
Attempting to get defaults from compiler found on the machine: 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe'
cpptools/activeDocumentChange
cpptools/textEditorSelectionChange
cpptools/didChangeFolderSettings
Attempting to get defaults from compiler in "compilerPath" property: 'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe'
Code browsing service initialized
Attempting to get defaults from compiler in "compilerPath" property: 'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe'
  Folder: C:/PROGRAM FILES/MINGW-W64/X86_64-8.1.0-POSIX-SEH-RT_V6-REV0/MINGW64/X86_64-W64-MINGW32/INCLUDE/ will be indexed
  Folder: C:/PRE-LAB-4/ will be indexed
  Folder: C:/PROGRAM FILES/MINGW-W64/X86_64-8.1.0-POSIX-SEH-RT_V6-REV0/MINGW64/LIB/GCC/X86_64-W64-MINGW32/8.1.0/ will be indexed
  Folder: C:/PROGRAM FILES/MINGW-W64/X86_64-8.1.0-POSIX-SEH-RT_V6-REV0/MINGW64/INCLUDE/ will be indexed
textDocument/didOpen
Populate include completion cache.
Discovering files...
  Processing folder (recursive): C:/PROGRAM FILES/MINGW-W64/X86_64-8.1.0-POSIX-SEH-RT_V6-REV0/MINGW64/X86_64-W64-MINGW32/INCLUDE/
Failed to spawn process. Error: 193 ()
Failed to spawn IntelliSense process: Unable to start child process!
Shutting down IntelliSense server: C:\PRE-LAB-4\TEST1.CPP
Checking for syntax errors: file:///c%3A/Pre-Lab-4/test1.cpp
Failed to spawn process. Error: 193 ()
Failed to spawn IntelliSense process: Unable to start child process!
Shutting down IntelliSense server: C:\PRE-LAB-4\TEST1.CPP
Failed to create IntelliSense client. Can't create intellisense client for C:\PRE-LAB-4\TEST1.CPP
  Processing folder (recursive): C:/PRE-LAB-4/
  Processing folder (recursive): C:/PROGRAM FILES/MINGW-W64/X86_64-8.1.0-POSIX-SEH-RT_V6-REV0/MINGW64/LIB/GCC/X86_64-W64-MINGW32/8.1.0/
  Processing folder (recursive): C:/PROGRAM FILES/MINGW-W64/X86_64-8.1.0-POSIX-SEH-RT_V6-REV0/MINGW64/INCLUDE/
  Discovering files: 2445 file(s) processed
  0 file(s) removed from database
Done discovering files.
Parsing open files...
Parsing remaining files...
  Parsing: 0 files(s) processed
Done parsing remaining files.
Done parsing open files.

Here is my c_cpp_properties.json file:

{
    "configurations": [
       {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}",
                "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0",
                "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0\\include\\c++",
                "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0\\include",
                "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0\\include-fixed",
                "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE"
            ],
            "compilerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "${workspaceFolder}",
                    "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0",
                    "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0\\include\\c++",
                    "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0\\include",
                    "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0\\include-fixed",
                    "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\include"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": "",
                "cStandard": "c11",
                "cppStandard": "c++11"
            }
        }
    ],
    "version": 4
}

@sean-mcmanus
Copy link
Collaborator

@starkblitz Your report matches the 193 error reported in #3052 . Can you run ProcMon, open some (small) workspace folder so our main process launches, clear the ProcMon log, change your includePath to an empty array and your compilerPath to an empty string (to reduce the ProcMon noise), change the filter to Microsoft.VSCode.CPP.Extension.exe (make sure that process is using 0 CPU first though), then open a C/C++ file. This should cause a Process Create operation to get logged for the Microsoft.VsCode.CPP.IntelliSense.Msvc.exe process or some other sort of failed operation related to that.

@ShubhamAvasthi
Copy link

ShubhamAvasthi commented Feb 3, 2019

I was also experiencing the 193 error with the Default intellisense engine. I solved it and intellisense now works perfectly. Hopefully, it helps.

  • VSCode version : 1.30.2 (stable, not insiders)
  • C/C++ Extension version : 0.21.0
  • Compiler : MinGW 32-bit

My username is Shubham Avasthi on my windows machine (notice the space). I tried to get some insights from ProcMon as instructed and found out that the C/C++ extension was trying to access C:/Users/Shubham (a file) which was locked for reading (unfortunately, I did not save the ProcMon logs).

Also, in my startup in Task Manager, a file named Shubham was present, which I disabled from startup long ago.

The content of the file was:

Could not recognize operation: A! 
DifxFrontend failed.

Enabling the file in startup and rebooting did not help.

On right clicking the file and clicking Open file location in Task Manager > Startup, it opened Facebook Gameroom's executable's location. I uninstalled Facebook Gameroom, deleted the file, kept the file startup enabled in Task Manager and rebooted.

After reboot, the file did not reappear and was gone from Startup as well and finally, Intellisense works without any issues.

I believe the C/C++ extension was trying to access C:/Users/Shubham Avasthi (the folder) or some file within that folder but because of the space and how windows resolves file system paths, the path was instead being resolved to C:/Users/Shubham (the file).

Addendum : Now my system seems to run much smoother as well.

Addendum2 : The first addendum is probably not true.

@sean-mcmanus sean-mcmanus assigned bobbrow and sean-mcmanus and unassigned bobbrow Feb 7, 2019
@sean-mcmanus sean-mcmanus added this to the February 2019 milestone Feb 7, 2019
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Feb 8, 2019
@sean-mcmanus sean-mcmanus removed their assignment Feb 8, 2019
@sean-mcmanus
Copy link
Collaborator

The bug with IntelliSense not working on Windows when the username has a space in it should be fixed with 0.22.0-insiders2: https://github.com/Microsoft/vscode-cpptools/releases .

@starkblitz
Copy link

starkblitz commented Mar 20, 2019

Wonderful!! Intellisense is working perfectly with the 0.22 update! Thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 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

5 participants