bradyt / dart-server

An Emacs minor mode for the Dart server
GNU General Public License v3.0
0 stars 0 forks source link

dart-server-find-refs on int opens a dart buffer that keeps growing in size #11

Open duianto opened 5 years ago

duianto commented 5 years ago

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:

// 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);

Observed Behavior

Three buffers open:

*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:

{"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:

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

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.