microsoft / microsoft/vscode-cpptools

Autocomplete becomes really slow when including third party library

Abierto
#5,864 10 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug Feature: Configuration investigate: repro Language Service parser performance reliability
Lenguaje dominante
TypeScript
Estrellas
6.2k
Forks
1.7k
Merge medio
14 h 46 min
PR fusionados (30 d)
61

Descripción

Type: LanguageService

Describe the bug

  • OS and Version: macOS Catalina (10.15.6)
  • VS Code Version: 1.47.3
  • C/C++ Extension Version: 0.29.0
  • Other extensions you installed (and if the issue persists after disabling them): CMake, CMake Tools
  • Does this issue involve using SSH remote to run the extension on a remote machine?: No
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).

I am trying to implement simple demo from https://pytorch.org/cppdocs/frontend.html. The problem occurs when I include #include <torch/torch.h>. The auto complete would not show up for seconds, sometimes it doesn't even show up and I need to force it by pressing ^+Space. I expect to have a cache file generated on the default path to cache the precompiled headers from that library, however I couldn't find it. I also tried to change the cache path, but still no files are generated.

Steps to reproduce

  1. Copy and follow instruction in https://pytorch.org/cppdocs/frontend.html on End-to-end Example section
  2. Include #include <torch/torch.h>
  3. Start typing. In my case even typing struct would not show any the auto complete at all

The following is my settings.json

{
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}

I don't use c_cpp_properties.json
And the following is my settings.json when I tried to change the cache path

{
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
    "C_Cpp.intelliSenseCachePath": ".vscode"
}

I only find ipch/<some_hash_id> folder inside .vscode, no files are generated

Expected behavior

Instant suggestion for autocomplete

C/C++: Log Diagnostics
-------- Diagnostics - 7/30/2020, 9:06:27 PM
Version: 0.29.0
Current Configuration:
{
    "name": "Mac",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [],
    "macFrameworkPath": [],
    "compilerPath": "/usr/local/bin/gcc-10",
    "cStandard": "c11",
    "cppStandard": "gnu++14",
    "intelliSenseMode": "clang-x64",
    "compilerArgs": [],
    "configurationProvider": "ms-vscode.cmake-tools",
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Custom browse configuration: 
{
    "browsePath": [
        "/volumes/workspace/learning/torchcpp/build/cmakefiles",
        "/volumes/workspace/learning/torchcpp/third_party/libtorch/include",
        "/volumes/workspace/learning/torchcpp/third_party/libtorch/include/torch/csrc/api/include",
        "/volumes/workspace/learning/torchcpp"
    ],
    "standard": "gnu++14",
    "compilerPath": "/usr/bin/clang++",
    "compilerArgs": [
        "-g",
        "-isysroot",
        "/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk",
        "-std=c++14",
        "-std=gnu++14"
    ]
}
Custom configurations:
[ /Volumes/Workspace/learning/torchcpp/main.cpp ]
{
    "defines": [],
    "standard": "gnu++14",
    "includePath": [
        "/volumes/workspace/learning/torchcpp/third_party/libtorch/include",
        "/volumes/workspace/learning/torchcpp/third_party/libtorch/include/torch/csrc/api/include"
    ],
    "intelliSenseMode": "clang-x64",
    "compilerPath": "/usr/bin/clang++",
    "compilerArgs": [
        "-g",
        "-isysroot",
        "/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk",
        "-std=c++14",
        "-std=gnu++14"
    ]
}
Translation Unit Mappings:
[ /Volumes/Workspace/learning/torchcpp/main.cpp ]:
    /Volumes/Workspace/learning/torchcpp/main.cpp
Translation Unit Configurations:
[ /Volumes/Workspace/learning/torchcpp/main.cpp ]:
    Process ID: 32992
    Memory Usage: 113 MB
    Compiler Path: /usr/bin/clang++
    Includes:
        /Volumes/Workspace/learning/torchcpp/third_party/libtorch/include
        /Volumes/Workspace/learning/torchcpp/third_party/libtorch/include/torch/csrc/api/include
        /Library/Developer/CommandLineTools/usr/include/c++/v1
        /Library/Developer/CommandLineTools/usr/lib/clang/11.0.3/include
        /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include
        /Library/Developer/CommandLineTools/usr/include
    Frameworks:
        /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks
    Standard Version: c++14
    IntelliSense Mode: clang-x64
    Other Flags:
        --clang
        --clang_version=110003
Total Memory Usage: 113 MB
Language Server Logs
textDocument/didChange: file:///Volumes/Workspace/learning/torchcpp/main.cpp
cpptools/textEditorSelectionChange
textDocument/didChange: file:///Volumes/Workspace/learning/torchcpp/main.cpp
cpptools/textEditorSelectionChange
textDocument/didChange: file:///Volumes/Workspace/learning/torchcpp/main.cpp
cpptools/textEditorSelectionChange
textDocument/didChange: file:///Volumes/Workspace/learning/torchcpp/main.cpp
cpptools/textEditorSelectionChange
cpptools/getFoldingRanges: file:///Volumes/Workspace/learning/torchcpp/main.cpp (id: 553)
textDocument/didChange: file:///Volumes/Workspace/learning/torchcpp/main.cpp
cpptools/abortRequest
cpptools/textEditorSelectionChange
textDocument/documentHighlight: file:///Volumes/Workspace/learning/torchcpp/main.cpp (id: 554)
sending 1 changes to server
sending 1 changes to server
sending 1 changes to server
sending 1 changes to server
sending 1 changes to server
cpptools/finishUpdateSquiggles
Error squiggle count: 9
Update IntelliSense time (sec): 3.702
cpptools/getFoldingRanges: file:///Volumes/Workspace/learning/torchcpp/main.cpp (id: 555)
textDocument/completion: file:///Volumes/Workspace/learning/torchcpp/main.cpp (id: 556)
auto_complete::handle_completion: file:///Volumes/Workspace/learning/torchcpp/main.cpp (47:7)
Offering completion
cpptools/getCodeActions: file:///Volumes/Workspace/learning/torchcpp/main.cpp (id: 557)
cpptools/getSemanticTokens: file:///Volumes/Workspace/learning/torchcpp/main.cpp (id: 558)
cpptools/getCodeActions: file:///Volumes/Workspace/learning/torchcpp/main.cpp (id: 559)
textDocument/didSave: file:///Volumes/Workspace/learning/torchcpp/main.cpp
cpptools/fileChanged: file:///Volumes/Workspace/learning/torchcpp/main.cpp
cpptools/getDocumentSymbols: file:///Volumes/Workspace/learning/torchcpp/main.cpp (id: 560)
cpptools/getDocumentSymbols
  tag parsing file: /Volumes/Workspace/learning/torchcpp/main.cpp
completionItem/resolve (id: 561)
idle loop: reparsing the active document
Checking for syntax errors: file:///Volumes/Workspace/learning/torchcpp/main.cpp
Queueing IntelliSense update for files in translation unit of: /Volumes/Workspace/learning/torchcpp/main.cpp
cpptools/finishUpdateSquiggles
Error squiggle count: 10
Update IntelliSense time (sec): 0.26
cpptools/getSemanticTokens: file:///Volumes/Workspace/learning/torchcpp/main.cpp (id: 562)
cpptools/getCodeActions: file:///Volumes/Workspace/learning/torchcpp/main.cpp (id: 563)
Database safe to open

Screenshots

Additional context

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el retraso con el include de PyTorch libtorch y la configuración mostrada de CMake Tools. Comienza por las entradas language-server textDocument/completion y auto_complete::handle_completion, y después inspecciona el momento de actualización de IntelliSense en los logs proporcionados. Se considera terminado cuando el autocompletado aparece rápidamente mientras se edita el ejemplo.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp, typescript
Área
devtools
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.