Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: drop change.rs <3#447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
psteinroe merged 10 commits intomainfromrefactor/changes
Jul 12, 2025
Merged

refactor: drop change.rs <3#447

psteinroe merged 10 commits intomainfromrefactor/changes
Jul 12, 2025

Conversation

psteinroe
Copy link
Collaborator

@psteinroepsteinroe commentedJul 11, 2025
edited
Loading

patrick-zen png

as per PR title. notable changes:

  • dropchange.rs in favour of a simpleupdate_document api that replaces the content
  • simplifyStatementId to just be a simple wrapper around the actual statement string. The content is wrapped in anArc<str> to make cloning cheap. turns out string interning only makes sense when we have a lot of duplicate strings.Arc<str> is much more efficient and simpler in our case.
  • Removedocument.rs and merge it intoparsed_document to then rename it toDocument
  • replaces thestrum usage to get the available command because it didn't feel right to make an empty string the default for a StatementId. replaced it with a simple manual implementation.

I ran a few benchmarks and the statement splitter performance seems to be good enough to run it on every keystroke on the entire file.

large statement with length 863000                                                                                                    time:   [23.180 ms 23.278 ms 23.386 ms]small statement with length 19000                                                                                                    time:   [886.69 µs 890.91 µs 896.35 µs]

ToDo

  • add some tests
  • cleanup

@psteinroepsteinroe marked this pull request as ready for reviewJuly 12, 2025 12:00
Copy link
Collaborator

@juleswritescodejuleswritescode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

very nice! much simpler, and I love that there's no separateParsedDocument anymore :)

Comment on lines 37 to 42
/// Creates a child statement ID with the given content and parent content.
pub fn new_child(child_content: &str, parent_content: &str) -> Self {
StatementId::Child {
content: child_content.into(),
parent_content: parent_content.into(),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is this used/needed? feels like we could create orphaned childs with this – not a problem right now, but maybe leads to confusion in the future?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nope, thanks!

}
}

pub fnparent(&self) ->Option<StatementId> {
pub fncontent(&self) ->&str {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

love it

@@ -641,9 +637,9 @@ impl Workspace for WorkspaceServer {
});

tracing::debug!(
"Found {} completion items for statement with id {}",
"Found {} completion items for statement with id {:?}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

that's probably a lot of log output – not sure we even need the print

/// Instead, we manually list the command IDs we want to register.
fn available_command_ids() -> Vec<String> {
vec![
"postgres-tools.executeStatement".to_string(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The ID inpgt_lsp/src/handlers/code_actions.rs also needs to be adjusted 👍

Copy link
Collaborator

@juleswritescodejuleswritescodeJul 12, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Also, we're now just sending the full statement over to the client anyway, so we might as well change the CommandActionCategory::ExecuteStatement(_) to hold aString instead of aStatementId – I think you can then use strum again :)

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

ah good point!

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

reverted my changes. I think its simpler to just add a comment to the default implementation

@psteinroepsteinroe merged commit27b6e7f intomainJul 12, 2025
7 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@juleswritescodejuleswritescodejuleswritescode approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@psteinroe@juleswritescode

[8]ページ先頭

©2009-2025 Movatter.jp