-
Notifications
You must be signed in to change notification settings - Fork 3
feat: ES-198 enhance performance when loading big projects #93
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
matiasdaloia
merged 11 commits into
main
from
feature/mdaloia/ES-198-SCANOSS-Code-Compare-Enhance-performance-for-big-projects
Feb 19, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bbcd872
feat: Use virtualization, improve performance in result mapper
matiasdaloia e5ddfa5
feat: Improve code viewer
matiasdaloia e4a4b1e
fix: editor scroll sync
matiasdaloia be925e1
feat: improve sidebar
matiasdaloia 798152b
feat: add loading state to results sidebar
matiasdaloia 42a074e
feat: add usequery cache, create reusable useResults hook
matiasdaloia e6d3dd9
feat: cache results in memory
matiasdaloia 9de6921
feat: more caching
matiasdaloia 57842a2
feat: refresh results cache after changing config
matiasdaloia 34ccf88
feat: small improvements
matiasdaloia e5f6358
feat: fix unit tests
matiasdaloia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| package entities | ||
|
|
||
| import ( | ||
| "github.com/fsnotify/fsnotify" | ||
| "github.com/rs/zerolog/log" | ||
| ) | ||
|
|
||
| type FileWatcher interface { | ||
| Start() error | ||
| Close() error | ||
| } | ||
|
|
||
| type fsNotifyWatcher struct { | ||
| watcher *fsnotify.Watcher | ||
| path string | ||
| onFileChange func() | ||
| } | ||
|
|
||
| func NewFsNotifyWatcher(path string, onFileChange func()) (FileWatcher, error) { | ||
| watcher, err := fsnotify.NewWatcher() | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return &fsNotifyWatcher{ | ||
| watcher: watcher, | ||
| path: path, | ||
| onFileChange: onFileChange, | ||
| }, nil | ||
| } | ||
|
|
||
| func (w *fsNotifyWatcher) Start() error { | ||
| if err := w.watcher.Add(w.path); err != nil { | ||
| log.Error().Err(err).Msgf("Error watching file: %s", w.path) | ||
| return w.Close() | ||
| } | ||
|
|
||
| go func() { | ||
| for { | ||
| select { | ||
| case event, ok := <-w.watcher.Events: | ||
| if !ok { | ||
| return | ||
| } | ||
| if event.Op&fsnotify.Write == fsnotify.Write { | ||
| w.onFileChange() | ||
| } | ||
| case err, ok := <-w.watcher.Errors: | ||
| if !ok { | ||
| return | ||
| } | ||
| log.Error().Err(err).Msg("Watcher error") | ||
| } | ||
| } | ||
| }() | ||
matiasdaloia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return nil | ||
| } | ||
|
|
||
| func (w *fsNotifyWatcher) Close() error { | ||
| return w.watcher.Close() | ||
| } | ||
matiasdaloia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.