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

Unable to start preLaunchTask when "C_Cpp.intelliSenseEngine": "Disabled" #9446

Closed
fonqL opened this issue Jun 14, 2022 · 9 comments
Closed
Assignees
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service regression A bug that didn't exist in a previous release tasks/build/debug An issue relating to tasks.json (e.g. build issues)
Milestone

Comments

@fonqL
Copy link

fonqL commented Jun 14, 2022

Environment

  • OS and version: Windows 10
  • VS Code: 1.65.0
  • C/C++ extension: 1.10.5
  • GDB / LLDB version: gdb 11.2

Bug Summary and Steps to Reproduce

Bug Summary:

I'm using clangd for code completion and also expect to use C/C++ for debug, so I enable the C/C++ plugin and disable the C/C++ intellisense engine. After pressing F5 vscode reports an error says the .exe program doesn't exist. But my preLaunchTask works well and generates .exe when I either disable C/C++ plugin or enable the "C_Cpp.intelliSenseEngine".
Disable clangd or reboot system can't solve the problem.
Also, if I set preLaunchTask with a non-existent task, it also report .exe doesn't exist instead of reporting "Could not find the task ...".
Why? and what should I do?

Steps to reproduce:

  1. Config launch.json and tasks.json, and set preLaunchTask to build task.
  2. Enable C/C++ and set "C_Cpp.intelliSenseEngine": "Disabled"
  3. Press F5
  4. vscode reports an error says the .exe program doesn't exist.

Debugger Configurations

launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb)launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "D:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "build"
        }
    ]
}

tasks.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "process",
            "label": "build",
            "command": "g++",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "-m64",
                "-Wall",
                "-Wextra",
                "-Wshadow",
                "-std=c++14",
                "-static-libgcc",
                "-fexec-charset=GBK",
                "-DFread",
                "-Wunreachable-code"
            ],
            "presentation": {
                "echo": false,
                "reveal": "silent",
                "showReuseMessage": false,
                "focus": false,
                "clear": true
            },
            "options": {},
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: D:\\MinGW\\bin\\g++.exe",
            "problemMatcher": []
        },
        {
            "label": "run",
            "type": "shell",
            "command": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "presentation": {
                "focus": true,
                "echo": false,
                "showReuseMessage": false,
                "clear": true
            },
            "group": {
                "kind": "test",
                "isDefault": true
            }
        }
    ]
}

Debugger Logs

None

Other Extensions

No response

Additional Information

No response

@fonqL
Copy link
Author

fonqL commented Jun 14, 2022

image

@sean-mcmanus sean-mcmanus added bug Language Service tasks/build/debug An issue relating to tasks.json (e.g. build issues) labels Jun 14, 2022
@sean-mcmanus sean-mcmanus added this to the 1.11 milestone Jun 14, 2022
@sean-mcmanus
Copy link
Collaborator

@fufufuqqq Do you know if this used to work in a previous version, such as 1.9.8? (We could also check this ourselves).

@elahehrashedi Do you know if this is related to your build task changes and/or do you have time to investigate this? If not, I could potentially look into, but I have multiple other issues in flight.

@bobbrow
Copy link
Member

bobbrow commented Jun 14, 2022

I've never seen a task with "type": "process" before. @fufufuqqq which extension provides the implementation for that task? Should it be "type": "cppbuild" instead?

cc: @elahehrashedi

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Jun 14, 2022

@bobbrow We do handle the "cppdbg" debugger type, so it's possible we skipping something required for that to work when intelliSenseEngine is Disabled. I recall the build task changes may have made debugger provider related changes too.

@elahehrashedi elahehrashedi added the regression A bug that didn't exist in a previous release label Jun 14, 2022
@elahehrashedi
Copy link
Contributor

elahehrashedi commented Jun 14, 2022

This is a regression.

  1. When the IntelliSense is disabled, the Vs Code will fail to run a cppbuild preLaunch task, so we run that build task before the launch starts.
  2. But if the task is not a cppbuild type, Vs Code should be able to resolve the preLaunch tasks before launch starts.

@elahehrashedi elahehrashedi added the fixed Check the Milestone for the release in which the fix is or will be available. label Jun 14, 2022
@sean-mcmanus sean-mcmanus modified the milestones: 1.11, 1.10.6 Jun 14, 2022
@sean-mcmanus
Copy link
Collaborator

@fonqL
Copy link
Author

fonqL commented Jun 15, 2022

I've never seen a task with "type": "process" before. @fufufuqqq which extension provides the implementation for that task? Should it be "type": "cppbuild" instead?

cc: @elahehrashedi

https://code.visualstudio.com/docs/editor/tasks#_custom-tasks
Here it says "type" can either be "shell" or "process".

@Trass3r
Copy link

Trass3r commented Jun 15, 2022

2. But if the task is not a `cppbuild` type, Vs Code should be able to resolve the preLaunch tasks before launch starts.

No it did affect standard vscode tasks too.
Now it finally works again, thanks. I was already puzzled why it stopped working.

@bobbrow
Copy link
Member

bobbrow commented Jun 15, 2022

https://code.visualstudio.com/docs/editor/tasks#_custom-tasks
Here it says "type" can either be "shell" or "process".

Thanks. It appears the documentation doesn't account for extension-provided "types" which are also valid, but it's good to know that the "process" type belongs to VS Code.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 30, 2022
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 regression A bug that didn't exist in a previous release tasks/build/debug An issue relating to tasks.json (e.g. build issues)
Projects
None yet
Development

No branches or pull requests

5 participants