Uncaught TypeError: Converting circular structure to JSON --> starting at object with constructor 'TextEditor' | property 'decorationManager' -> object with constructor 'DecorationManager' --- property 'editor' closes the circle
sbrl opened this issue ยท 7 comments
Reproduction steps
- Install
zen
,highlight-selected
, andminimap-highlight-selected
- Enter zen mode (for me I have the minimap hidden in Zen mode - don't know if that affects anything)
- Double click on a word
- See error
This bug was also previously reported here which was apparently a duplicate of this bug, but ultimately it was determined that the bug is located in this package, not highlight-selected
.
Atom: 1.56.0 x64
Electron: 9.4.4
OS: Ubuntu 20.10
Thrown From: highlight-selected package 0.17.0
Stack Trace
Uncaught TypeError: Converting circular structure to JSON
--> starting at object with constructor 'TextEditor'
| property 'decorationManager' -> object with constructor 'DecorationManager'
--- property 'editor' closes the circle
At /home/sbrl/.atom/packages/highlight-selected/lib/search-model.js:230
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'TextEditor'
| property 'decorationManager' -> object with constructor 'DecorationManager'
--- property 'editor' closes the circle
at JSON.stringify (<anonymous>)
at Xt.getDecorationManagement (/packages/minimap/dist/main-022ad455.js:1:93936)
at Xt.decorateMarker (/packages/minimap/dist/main-022ad455.js:1:94831)
at Object.markerCreated (/packages/minimap-highlight-selected/lib/minimap-highlight-selected.js:71:12)
at /packages/minimap-highlight-selected/lib/minimap-highlight-selected.js:47:66
at Function.simpleDispatch (/usr/share/atom/resources/app/static/<embedded>:11:1182710)
at Emitter.emit (/usr/share/atom/resources/app/static/<embedded>:11:1184151)
at /packages/highlight-selected/lib/search-model.js:215:41
at TextBuffer.scanInRange (/usr/share/atom/resources/app/static/<embedded>:11:497018)
at TextBuffer.scan (/usr/share/atom/resources/app/static/<embedded>:11:496474)
at TextEditor.scan (/usr/share/atom/resources/app/static/<embedded>:11:43334)
at SearchModel.highlightSelectionInEditor (/packages/highlight-selected/lib/search-model.js:176:14)
at /packages/highlight-selected/lib/search-model.js:129:21
at Array.forEach (<anonymous>)
at SearchModel.handleSelection (/packages/highlight-selected/lib/search-model.js:128:26)
at /packages/highlight-selected/lib/selection-manager.js:96:26)
at later (/packages/highlight-selected/node_modules/debounce/index.js:27:23)
Commands
-1:38.7.0 tree-view:toggle (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui.teletype-Authenticated)
-1:38.7.0 minimap:toggle (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui.teletype-Authenticated)
-1:36.1.0 core:backspace (input.hidden-input)
-1:35.3.0 intentions:highlight (input.hidden-input)
-1:35 core:save (input.hidden-input)
13x -1:30.4.0 core:backspace (input.hidden-input)
-1:22.1.0 intentions:highlight (input.hidden-input)
-1:22 editor:delete-to-beginning-of-word (input.hidden-input)
10x -1:21.6.0 core:backspace (input.hidden-input)
-1:14.2.0 intentions:highlight (input.hidden-input)
-1:14.1.0 editor:delete-to-beginning-of-word (input.hidden-input)
5x -1:13.6.0 core:backspace (input.hidden-input)
-1:01.5.0 core:move-left (input.hidden-input)
-0:58.4.0 intentions:highlight (input.hidden-input)
-0:58.3.0 core:save (input.hidden-input)
-0:44.3.0 core:cancel (a.btn-issue.btn.btn-error)
Non-Core Packages
atom-beautify 0.33.4
atom-debug-ui 1.0.4
atom-ide-debugger-native-gdb 0.7.3
atom-ide-debugger-node 0.7.3
atom-ide-ui 0.13.0
atom-linter-phpstan 2.1.1
atom-ternjs 0.20.0
atom-typescript 14.2.1
audio 1.5.7
aural-coding 1.0.1
autocomplete-awk 0.1.2
autocomplete-clang 0.13.1
autocomplete-glsl 0.2.3
autocomplete-html-entities 0.2.0
autocomplete-json 5.5.5
autocomplete-lua 0.9.2
autocomplete-math 0.1.1
autocomplete-modules 2.3.0
autocomplete-paths 2.15.2
autocomplete-sql 0.5.0
bibtex-helper 2.0.0
busy 0.7.0
busy-signal 2.0.1
caniuse 1.0.0
change-case 0.6.5
close-tags 0.6.0
color-picker 2.3.0
column-select 1.0.1
css-hyperclick 0.1.5
cursor-history 0.14.0
devdocs 0.2.1
docblockr 0.13.7
document-outline 2.1.2
file-icons 2.1.47
font-preview 0.1.2
git-log 0.4.1
github-user-datatip 0.3.2
highlight-selected 0.17.0
hyperclick 0.0.0
hyperclick-latex 0.5.8
hyperclick-markdown 0.2.2
hyperlink-hyperclick 3.0.2
ide-bash 1.0.11
ide-cpp 0.1.0
ide-csharp 0.6.2
ide-css 0.3.5
ide-docker 0.1.0
ide-html 0.6.2
ide-json 0.2.1
ide-python 1.8.0
ide-rust 0.22.0-beta.3
ide-typescript 0.9.2
inline-markdown-images 1.15.0
intentions 1.1.5
js-hyperclick 1.19.0
language-arduino 0.4.3
language-awk 0.1.12
language-bison-improved 0.9.7
language-bnf 1.1.0
language-cshtml 0.4.2
language-diff 0.7.0
language-docker 1.1.8
language-gitignore 0.3.0
language-glsl 2.0.4
language-gnuplot-atom 0.2.0
language-hcl 0.4.0
language-hjson 1.0.2
language-ignore 1.8.0
language-ilasm 0.0.1
language-ini 1.25.0
language-latex 1.2.0
language-lex-flex-new 0.2.1
language-lua 0.9.11
language-markdown 0.37.0
language-nginx 0.8.0
language-openscad 0.4.3
language-prolog 0.11.0
language-regexp 1.1.3
language-rust 0.4.12
language-svg 0.9.2
language-wren 0.2.0
latex-completions 0.3.6
latex-hyperclick 0.2.0
line-count-status 0.0.3
linter 3.3.1
linter-flake8 2.4.0
linter-gcc 0.9.0
linter-jsonlint 1.4.0
linter-lua 2.0.0
linter-php 1.6.1
linter-rust-cargo 1.1.0
linter-shellcheck 1.6.0
linter-tidy 2.4.0
linter-toml 0.1.1
linter-ui-default 3.3.1
MagicPython 1.1.1
minimap 4.39.13
minimap-bookmarks 0.4.6
minimap-codeglance 0.4.7
minimap-find-and-replace 5.0.8
minimap-git-diff 4.3.6
minimap-highlight-selected 4.6.5
minimap-linter 2.2.2
minimap-pigments 0.2.2
minimap-selection 4.5.4
minimap-titles 1.15.0
move-status-items 0.1.1
nearley-grammar 0.1.3
open-in-browser 0.5.2
package-cop 0.2.10
pdf-view 0.72.0
php-debug 0.3.5
php-ide-serenata 5.4.0
pigments 0.40.6
project-manager 3.3.8
project-plus 1.0.0
protector 0.2.3
rainbow-csv 1.4.0
rainbow-tabs 2.5.1
rainbow-tabs-evolved 2.7.14
regex-railroad-diagram 0.19.4
skyliner 0.0.0
spell-check-urls 0.5.1
ssh-config 0.14.0
Sublime-Style-Column-Selection 1.7.5
summer-night-syntax 2.0.1
switch-header-source 0.34.5
sync-settings 5.2.10
teletype 0.13.4
terminal-tab 0.6.0
wordcount 3.2.0
Zen 0.18.0
I can reproduce this. I will look into it tonight.
I haven't used Zen mode before. We should also fix the error message. Does it seem that one of the packages is modifying the MinimapElement
? If you can reproduce it, it would be nice to get a PR.
It seems like zen mode toggles minimap but minimap doesn't stop trying to create markers.
Toggling works without issues unless you overdo it consecutively and close/open text editors multiple times (#772). Once Minimap.destory
is called inside toggle the classes become null.
Line 166 in 47cb108
The solution is that the plugins should check if what they are getting is valid. They should check if the return of the old API is valid (non-null).
Line 1131 in 47cb108
The other solution is to use the new DecorationsManagement API from the minimapElement
and not minimap.
We can also do something like the following if the plugins don't already do the null check. In this case, we should return null
from getDecorationManagement
instead of throwing, and then return an empty array, which keeps the API type-safe preventing null-bugs
getDecorations() {
return this.getDecorationManagement()?.getDecorations() ?? []
}
Lines 1130 to 1133 in 47cb108
๐ This issue has been resolved in version 4.39.14 ๐
The release is available on:
Your semantic-release bot ๐ฆ๐