Skip to content

PoC: snapshot#1889

Draft
acamargo wants to merge 18 commits into
clojure-lsp:masterfrom
acamargo:poc-snapshot
Draft

PoC: snapshot#1889
acamargo wants to merge 18 commits into
clojure-lsp:masterfrom
acamargo:poc-snapshot

Conversation

@acamargo

@acamargo acamargo commented Oct 20, 2024

Copy link
Copy Markdown
Contributor

Important

This is a proof-of-concept and the code needs improvements and optimizations in order to reach a production level standard.

Why

When working with a legacy codebase with numerous linter issues, prioritizing code sanitization can be overwhelming. This PR introduces a "snapshot" feature to alleviate this burden by allowing you to "pause" diagnostics for existing code, focusing on addressing new issues that arise.

What

The snapshot feature freezes the diagnostics currently present in your codebase, preventing Clojure-LSP from highlighting them. This allows you to concentrate on making incremental improvements without being overwhelmed by past linter violations.

How

To create a snapshot, simply run the following command:

clojure-lsp diagnostics --raw > .lsp/snapshot.txt

Once the snapshot is created, Clojure-LSP will automatically ignore any diagnostics listed in the .lsp/snapshot.txt file during subsequent analysis, providing a more focused development experience.


  • I created an issue to discuss the problem I am trying to solve or an open issue already exists.
  • I added a new entry to CHANGELOG.md
  • I updated documentation if applicable (docs folder)

Comment thread lib/src/clojure_lsp/snapshot.clj Outdated
Comment thread lib/src/clojure_lsp/snapshot.clj Outdated
Comment thread lib/src/clojure_lsp/snapshot.clj Outdated
Comment thread lib/src/clojure_lsp/snapshot.clj Outdated

result))

(defn discard

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I consider as a must have measure the time we take on this function.
Using criterium is probably the fastest way: https://clojure-lsp.io/development/#debugging-profiling

@ericdallo ericdallo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder what extension should we save the file, txt, edn, transit, I'd like to understand the performance for txt in a real world scenario (a project with considerably large diagnostics and some snapshots)

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.

3 participants