halohalospecial / atom-elmjutsu

A bag of tricks for developing with Elm. (Atom package)
https://atom.io/packages/elmjutsu
MIT License
192 stars 24 forks source link

markBufferRange doesn't allow persistent option #32

Open pablomayobre opened 7 years ago

pablomayobre commented 7 years ago

Since 1.12 (and even more likely in 1.13) markBufferRange as stated in atom/text-buffer#154 doesn't pass the persistent option down. Instead you need to use a addMarkerLayer and then use markRange in that layer, as commented in that same issue. This is due to the changes that happened at atom/text-buffer#149

This is change needs to be applied to the line 97 of symbol-finder.js

Due to this a deprecation warning is shown in the deprecation cop. Again this is most likely due to the use of Atom Beta 1.13, but there shouldn't be impact in 1.12 by performing this change.

The actual error is:

Assigning custom properties to a marker when creating/copying it is deprecated. Please, consider storing the custom properties you need in some other object in your package, keyed by the marker's id property.

Function.extractParams - C:\Users\xxxxxx\AppData\Local\atom\app-1.13.0-beta8\resources\app.asar\node_modules\text-buffer\lib\marker.js:43:14
MarkerLayer.markRange - C:\Users\xxxxxx\AppData\Local\atom\app-1.13.0-beta8\resources\app.asar\node_modules\text-buffer\lib\marker-layer.js:196:71
DisplayMarkerLayer.markBufferRange - C:\Users\xxxxxx\AppData\Local\atom\app-1.13.0-beta8\resources\app.asar\node_modules\text-buffer\lib\display-marker-layer.js:90:62
TextEditor.markBufferRange - C:\Users\xxxxxx\AppData\Local\atom\app-1.13.0-beta8\resources\app.asar\src\text-editor.js:1753:38
<unknown> - C:\Users\xxxxxx\.atom\packages\elmjutsu\lib\symbol-finder.js:125:40

But the pointed line and character is actually after the compilation through Babel.

I searched the compile-cache folder and found the file with the name 2a724e462a7edea8b03d0703a18f5d8b77e028d0.js which is the hash of symbol-finder.js and the compiled line 125 was:

          _this3.symbolMarker = editor.markBufferRange(symbolRange, { invalidate: 'never', persistent: false });
halohalospecial commented 7 years ago

Thanks again, @Positive07! Let's just apply this on the Atom 1.13 version :-)

halohalospecial commented 7 years ago

Hi @Positive07, my Atom got automatically updated to 1.13.0, but I didn't see these issues in the deprecation cop. Should I do anything extra to see them? Thanks!

pablomayobre commented 7 years ago

Couldn't find this issue in Symbol finder because I can't "Go to Symbol/Declaration/Next usage/Previous Usage" as I reported in #28

I found a very similar issue in "Pipe Selection" to replicate, open the Command Pallete (Ctrl + Shift + P) search for "Elmjutsu: Pipe Selection" and select it, now go to the Deprecation Cop