Problem with structure field hints

オープン
#14,590 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
c, typescript
領域
tooling

調査の方向性

main.c で、3 つのテスト用 completion 位置と記載された演算子を使って問題を再現し、その後 textDocument/completion リクエストを auto_complete::handle_completion を通して追跡します。2 番目の位置では completion が表示されるのに、1 番目または 3 番目では表示されない理由を比較します。報告されたコンテキストと演算子で構造体フィールドのヒントが一貫して表示されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug verified Visual Studio
Environment
  • OS and Version: Windows 10 LTSC 2018
  • VS Code Version: 1.129.1
  • C/C++ Extension Version: 1.32.2
Bug Summary and Steps to Reproduce
  1. Create a main.c file with the following contents::
struct {
    int a;
    int b;
} test;

int main(){
    int err = 0;

    test.
    err++;

    test.
    err = err + 1;

    test.
    err--;
}

It's expected that pressing ctrl+space will give us a tooltip, but the first and third "test." the hint doesn't appear, it only works for the second one. ++, --, +=, -=, *=, /=, |=, &=, and ^=/ have similar behavior.

Configuration and Logs
loggingLevel: 6
loggingLevel был изменен на: Debug
Обработан файл c_cpp_properties.json за 0.0065977 с
Intellisense update pending for: file:///c%3A/prog/c/bugTest/main.c
Завершение работы сервера IntelliSense: C:\prog\c\bugTest\main.c
LSP: (received) cpptools/didChangeCppProperties (id: 453)
LSP: (invoked) cpptools/didChangeCppProperties (id: 453)
Попытка получить значения по умолчанию из компилятора C++ в свойстве "compilerPath": "cl.exe"
Попытка получить значения по умолчанию из компилятора C в свойстве "compilerPath": "cl.exe"
  Папка C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\18\BUILDTOOLS\VC\TOOLS\MSVC\14.50.35717\INCLUDE будет индексироваться
  Папка C:\PROG\C\BUGTEST будет индексироваться
LSP: Sending response (id: 453)
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/prog/c/bugTest/main.c (id: 454)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/prog/c/bugTest/main.c (id: 454)
LSP: Sending response (id: 454)
LSP: (received) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 455)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 455)
LSP: Sending response (id: 455)
LSP: $/cancelRequest (<unknown/completed>, id: 455)
LSP: (received) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 456)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 456)
LSP: Sending response (id: 456)
IntelliSense update scheduled and TU acquisition started for: file:///c%3A/prog/c/bugTest/main.c
Populating file name cache...
Done populating filename cache. Elapsed time: 0 ms
Expanding recursive includes for: C:\PROG\C\BUGTEST\MAIN.C
Done expanding recursive includes for: C:\PROG\C\BUGTEST\MAIN.C
Reducing recursive includes for: C:\PROG\C\BUGTEST\MAIN.C
Done reducing recursive includes for: C:\PROG\C\BUGTEST\MAIN.C
Отправка аргументов компиляции для C:\prog\c\bugTest\main.c.
  system include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\18\BUILDTOOLS\VC\TOOLS\MSVC\14.50.35717\INCLUDE
  define: _DEBUG
  define: UNICODE
  define: _UNICODE
  stdver: ms_c17
  intelliSenseMode: windows-msvc-x64
Время обновления IntelliSense (в секундах): 0.038
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/prog/c/bugTest/main.c (id: 457)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/prog/c/bugTest/main.c (id: 457)
LSP: Sending response (id: 457)
LSP: (received) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 458)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 458)
LSP: Sending response (id: 458)
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/prog/c/bugTest/main.c (id: 459)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/prog/c/bugTest/main.c (id: 459)
LSP: Sending response (id: 459)
LSP: (received) cpptools/didChangeActiveEditor: file:///c%3A/prog/c/bugTest/main.c
LSP: (invoked) cpptools/didChangeActiveEditor: file:///c%3A/prog/c/bugTest/main.c
LSP: (received) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 460)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 460)
LSP: Sending response (id: 460)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 461)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 461)
LSP: Sending response (id: 461)
LSP: (received) textDocument/completion: file:///c%3A/prog/c/bugTest/main.c (id: 462)
LSP: (invoked) textDocument/completion: file:///c%3A/prog/c/bugTest/main.c (id: 462)
auto_complete::handle_completion: file:///c%3A/prog/c/bugTest/main.c (9:10)
Предлагается завершение.
LSP: Sending response (id: 462)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 463)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 463)
LSP: Sending response (id: 463)
LSP: (received) textDocument/completion: file:///c%3A/prog/c/bugTest/main.c (id: 464)
LSP: (invoked) textDocument/completion: file:///c%3A/prog/c/bugTest/main.c (id: 464)
auto_complete::handle_completion: file:///c%3A/prog/c/bugTest/main.c (12:10)
Предлагается завершение.
LSP: Sending response (id: 464)
LSP: (received) completionItem/resolve (id: 465)
LSP: (invoked) completionItem/resolve (id: 465)
LSP: Sending response (id: 465)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 466)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/prog/c/bugTest/main.c (id: 466)
LSP: Sending response (id: 466)
LSP: (received) textDocument/completion: file:///c%3A/prog/c/bugTest/main.c (id: 467)
LSP: (invoked) textDocument/completion: file:///c%3A/prog/c/bugTest/main.c (id: 467)
auto_complete::handle_completion: file:///c%3A/prog/c/bugTest/main.c (15:10)
Предлагается завершение.
LSP: Sending response (id: 467)
Other Extensions

No response

Additional context

No response

主要言語
TypeScript
スター
6.2k
フォーク
1.7k
平均マージ
14時間 46分
マージ済み PR(30日)
61

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/vscode-cpptools のほかの issue

microsoft/vscode-cpptools の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。