Skip to content

refactor(workspace): a document_cache module for what a document caches - #1003

Open
psteinroe wants to merge 2 commits into
fix/one-statement-walkfrom
refactor/document-cache-module
Open

psteinroe wants to merge 2 commits into
fix/one-statement-walkfrom
refactor/document-cache-module

Conversation

@psteinroe

Copy link
Copy Markdown
Collaborator

Stacked on #1002. Part of the rebuild described in #997 (point 4: one cache per document, in one module).

A move without behaviour changes. The parse results and the tree-sitter trees of a document's statements move from server/pg_query.rs and server/tree_sitter.rs into server/document_cache/{parse,tree}.rs, behind a DocumentCache that the Document owns:

  • parse, plpgsql_parse, embedded and tree look up or compute what is cached for a statement;
  • retain_statements drops what was cached for the statements that are no longer in the document.

The mappers and Document::update_content call these instead of reaching into the two stores. The psql parameter conversion that pg_query.rs re-exported is imported from pgls_lexer directly.

The next PRs add what depends on the settings and the database to this module (the analysis, the walk checkpoints, the resolved references), under one key and one invalidation rule.

Tests

pgls_workspace and clippy pass unchanged.

The parse results and the tree-sitter trees of a document's statements
move into server/document_cache, behind a DocumentCache that the document
owns. No behaviour changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant