microsoft / microsoft/vscode-cpptools

edge_filebuf will rebuild line mappings for every character typed

Open
#11,791 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

internal Language Service performance
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

edge_filebuf::handle_update will incur rebuilding of document line mappings. It looks like this is a consequence of calling convert_line_char_to_offset_vscode_inner, which appears to be required in order to call edge::file_buffer::update and to set an updated_region that is being returned (but not currently used).

This code is invoked for both tag parsing and IntelliSense. It's called while the user is typing, per character typed, despite tag parsing and IntelliSense updates being deferred. Despite all changes being cached for IntelliSense and delivered all at once for the next IntelliSense operation, they are then still processed one-by-one, incurring repeated rebuilding of line mappings.

This has a huge performance impact when typing within very large files.

Opening this issue to track avoiding these unnecessary updates - for tag parsing, until tag parsing is kicked off - for IntelliSense, until done processing a full batch of changes prior to an IntelliSense operation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at edge_filebuf::handle_update and trace its calls to convert_line_char_to_offset_vscode_inner and edge::file_buffer::update. Determine how tag parsing and IntelliSense batches are processed, then verify that line mappings are not rebuilt for each typed character and that deferred updates still occur before parsing or IntelliSense operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
developer-experience, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.