vscode TypeScript Intellisense似乎被阻止在geterr上,

gab6jxml  于 6个月前  发布在  Vscode
关注(0)|答案(2)|浏览(60)

你好!我们的团队中的许多成员在过去的几个月里遇到了TypeScript Intellisense速度变慢的问题。我们可以通过打开一个项目,等待TS初始化,然后尝试几次自动完成建议来一致地重现它。第一次总是很快,然后第二次及以后变得非常慢。

我分析了我的TS服务器日志,发现了一些可能或不相关的事情。在这个重现步骤中:

我多次尝试了这个流程,每次出现延迟的一致原因是后台运行的 geterr 请求。我不确定它是否应该在用户输入时取消 geterr ,但根据过去的线程,这似乎是预期的行为。

来自其中一个TS服务器的日志(不确定是语义还是语法):

Info 13826[08:49:08.002] request:
    {"seq":70,"type":"request","command":"geterr","arguments":{"delay":0,"files":["/Users/mhuang/***"]}}
Perf 13827[08:49:08.003] 70::geterr: async elapsed time (in milliseconds) 0.1670
Info 13828[08:49:08.004] event:
    {
      "seq": 0,
      "type": "event",
      "event": "syntaxDiag",
      "body": {
        "file": "/Users/mhuang/***",
        "diagnostics": []
      }
    }
Info 13829[08:49:13.439] event:
    {
      "seq": 0,
      "type": "event",
      "event": "requestCompleted",
      "body": {
        "request_seq": 70
      }
    }

...

Info 13833[08:49:13.447] request:
    {"seq":74,"type":"request","command":"updateOpen","arguments":{"changedFiles":[{"fileName":"***","textChanges":[{"newText":".","start":{"line":111,"offset":8},"end":{"line":111,"offset":8}}]}],"closedFiles":[],"openFiles":[]}}
Perf 13834[08:49:13.447] 74::updateOpen: elapsed time (in milliseconds) 0.0568
Info 13835[08:49:13.447] response:
    {
      "seq": 0,
      "type": "response",
      "command": "updateOpen",
      "request_seq": 74,
      "success": true,
      "body": true
    }
Info 13836[08:49:13.447] request:
    {"seq":75,"type":"request","command":"completionInfo","arguments":{"file":"***","line":111,"offset":9,"includeExternalModuleExports":true,"includeInsertTextCompletions":true,"triggerCharacter":".","triggerKind":2}}
Info 13837[08:49:13.447] Starting updateGraphWorker: Project: /Users/mhuang/***
Info 13838[08:49:13.605] Finishing updateGraphWorker: Project: /Users/mhuang/*** projectStateVersion: 5 projectProgramVersion: 1 structureChanged: false structureIsReused:: Completely Elapsed: 157.49274998903275ms
Info 13839[08:49:13.605] Different program with same set of files
Info 13840[08:49:13.605] getCompletionData: Get current token: 0.005082964897155762
Info 13841[08:49:13.605] getCompletionData: Is inside comment: 0.008708000183105469
Info 13842[08:49:13.605] getCompletionData: Get previous token: 0.008375048637390137
Info 13843[08:49:13.605] getCompletionsAtPosition: isCompletionListBlocker: 0.007040977478027344
Info 13844[08:49:13.607] getCompletionData: Semantic work: 1.8783329725265503
Info 13845[08:49:13.608] getCompletionsAtPosition: getCompletionEntriesFromSymbols: 0.43924999237060547
Perf 13846[08:49:13.608] 75::completionInfo: elapsed time (in milliseconds) 160.5698
Info 13847[08:49:13.608] response: {
  ...
}

将这些计时与与VSCode一起初始化的分叉TS服务器进行比较(不确定如何区分哪个是语义服务器和语法服务器):

Info 190  [08:49:10.399] request:
    {"seq":48,"type":"request","command":"updateOpen","arguments":{"changedFiles":[{"fileName":"***","textChanges":[{"newText":".","start":{"line":111,"offset":8},"end":{"line":111,"offset":8}}]}],"closedFiles":[],"openFiles":[]}}
Perf 191  [08:49:10.399] 48::updateOpen: elapsed time (in milliseconds) 0.1473
Info 192  [08:49:10.399] response:
    {
      "seq": 0,
      "type": "response",
      "command": "updateOpen",
      "request_seq": 48,
      "success": true,
      "body": true
    }
Info 193  [08:49:10.405] request:
    {"seq":49,"type":"request","command":"navtree","arguments":{"file":"/Users/mhuang/***"}}
Perf 194  [08:49:10.408] 49::navtree: elapsed time (in milliseconds) 2.4095
Info 195  [08:49:10.409] response: { ...

似乎当我输入时,其中一个服务器在49:10捕获了 updateOpen 请求,但另一个服务器(在 geterr 中间)直到 geterr 在49:13完成才捕获 updateOpen 请求。

提前感谢并告知我们可以做些什么来提供有用的诊断信息。非常感谢!
当所有扩展都被禁用时,这个问题是否发生?:是

  • VS Code版本:1.87.2(在1.85.2上也重现了这个问题,但没有尝试过夜间构建)
  • OS版本:macOS Monterey 12.2.1
cbeh67ev

cbeh67ev1#

感谢您提出这个问题!看起来您可能正在使用旧版本的VS Code,最新稳定版本是1.87.2。请尝试升级到最新版本并检查此问题是否仍然存在。
快乐编码!

9jyewag0

9jyewag02#

刚才再次在1.87.2上进行了测试,确认它仍然存在问题。

相关问题