dart-server-find-refs on int opens a dart buffer that keeps growing in size
- Dominant language
- Emacs Lisp
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Calling `dart-server-find-refs` (`C-c C-f`) on an instance of `int` in the following example file. Opens a `dart-server-analysis-server` buffer that keeps growing in size, which slows down Emacs.
#### Reproduction steps
Create an example file: `fibonacci.dart`
containing:
```dart
// https://dart.dev/samples#functions
int fibonacci(int n) {
if (n == 0 || n == 1) return n;
return fibonacci(n - 1) + fibonacci(n - 2);
}
var result = fibonacci(20);
```
- Open the file and enable `M-x dart-server RET`
- Move the cursor to either instance of `int`
- Press `C-c C-f` which calls `dart-server-find-refs`
#### Observed Behavior
Three buffers open:
- `*Dart Search*`
- `*dart-server-analysis-server*`
- `dart-server-analysis-server`
`*Dart Search*` opens in another window and it just shows:
```
References to int:
```
the other two buffers open in the background.
`*dart-server-analysis-server*` is empty.
But opening the `dart-server-analysis-server` buffer: `C-x b` `dart-serv` `TAB` `RET`
shows that json expressions? keeps being printed to the buffer:
```json
{"event":"search.results","params":{"id":"0","results":[{"location":{"file":"c:\\Users\\username\\Temp\\fibonacci.dart","offset":39,"length":3,"startLine":2,"startColumn":1},"kind":"REFERENCE","isPotential":false,"path":[{"kind":"FUNCTION","name":"fibonacci","location":{"file":"c:\\Users\\username\\Temp\\fibonacci.dart","offset":43,"length":9,"startLine":2,"startColumn":5},"flags":8,"parameters":"(int n)","returnType":"int"},{"kind":"COMPILATION_UNIT","name":"fibonacci.dart","location":{"file":"c:\\Users\\username\\Temp\\fibonacci.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":16},{"kind":"LIBRARY","name":"","location":{"file":"c:\\Users\\username\\Temp\\fibonacci.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":0}]},{"location":{"file":"c:\\Users\\username\\Temp\\fibonacci.dart","offset":53,"length":3,"startLine":2,"startColumn":15},"kind":"REFERENCE","isPotential":false,"path":[{"kind":"PARAMETER","name":"n","location":{"file":"c:\\Users\\username\\Temp\\fibonacci.dart","offset":57,"length":1,"startLine":2,"startColumn":19},"flags":0,"returnType":"int"},{"kind":"FUNCTION","name":"fibonacci","location":
```
I don't know if it every stops. After only a couple of seconds when I was able to copy the buffer:
- `M-h` (`mark-paragraph`)
- `M-w` (`kill-ring-save`)
It already contained over 100k characters, but with another test that took longer to copy the buffer, it had grown to over 2 million characters.
I've always close that buffer (`C-x k`) so I don't know if it eventually will crash Emacs.
#### System Info
Only the `dart-server` package (and it's dependencies) were installed from Melpa. `M-x package-install` `dart-server` `RET`
The `dart-server.el` header shows:
>;; Package-Version: 20190817.1254
;; Version: 0.1.0
- Ubuntu 18.04.02
GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-08-25
- Windows 1903
GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29
#### Notes:
It might just be an issue when trying to find a reference for `int`.
Because after restarting Emacs.
Pressing `C-c C-f` on `fibonacci` seems to be working as expected.
The `*Dart Search*` buffer shows:
```
References to fibonacci:
fibonacci c:\Users\username\Temp\fibonacci.dart:4:10
fibonacci c:\Users\username\Temp\fibonacci.dart:4:29
result c:\Users\username\Temp\fibonacci.dart:7:14
Found 3 results.
```
and the two hidden dart server analysis buffers remain empty.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the report with fibonacci.dart: enable M-x dart-server and run C-c C-f on int, then inspect the dart-server-analysis-server buffers. Compare this with running the command on fibonacci. The fix is done when searching for int no longer causes unbounded analysis-server buffer growth and the Dart Search result remains usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, emacs-lisp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100