mechatroner / atom-rainbow-csv

:rainbow: Atom package: Highlight CSV and TSV spreadsheet files in different rainbow colors
MIT License
16 stars 0 forks source link

ERROR happening on typing a coma #7

Closed hugo13122000 closed 4 years ago

hugo13122000 commented 4 years ago

Hello there, I get a big red error box whenever I try to add a coma on my csv file :

CSV file

nom, email Hugo B, x Marie, x Hugo T, x Solen, x Coralie, x Léa, x Gauvain, x Camille, x impair, x

when it happens

Client info

Atom: 1.41.0 x64 Electron: 4.2.7 OS: Microsoft Windows 10 Pro Thrown From: rainbow-csv package 0.4.1

Stack Trace

Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.

At C:\Users\Hugo\.atom\packages\rainbow-csv\index.js:71

TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
    at get_column_color (/packages/rainbow-csv/index.js:71:17)
    at display_position_info (/packages/rainbow-csv/index.js:100:56)
    at show_statusbar_tiles (/packages/rainbow-csv/index.js:204:9)
    at editor.onDidChangeCursorPosition.event (/packages/rainbow-csv/index.js:263:79)
    at Function.simpleDispatch (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:1211909)
    at Emitter.emit (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:1213350)
    at TextEditor.cursorMoved (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:33212)
    at Selection.markerDidChange (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:547364)
    at Selection.marker.onDidChange.e (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:532507)
    at Function.simpleDispatch (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:1211909)
    at Emitter.emit (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:1213350)
    at DisplayMarker.notifyObservers (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:14:2857418)
    at ~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:14:2852920
    at Function.simpleDispatch (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:1211909)
    at Emitter.emit (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:1213350)
    at Marker.emitChangeEvent (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:14:73563)
    at ~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:14:80000
    at Set.forEach (<anonymous>)
    at MarkerLayer.emitChangeEvents (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:14:79945)
    at TextBuffer.emitMarkerChangeEvents (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:504200)
    at TextBuffer.transact (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:492837)
    at TextEditor.transact (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:24215)
    at mergeIntersectingSelections (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:16150)
    at TextEditor.mergeSelections (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:39484)
    at TextEditor.mergeIntersectingSelections (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:39038)
    at TextEditor.mutateSelectedText (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:16113)
    at TextEditor.insertText (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:15662)
    at TextEditor.e.(anonymous function) [as insertText] (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:258324)
    at TextEditorComponent.didTextInput (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:94325)

Commands

     -3:14.2.0 application:new-window (input.hidden-input)
     -3:05.9.0 intentions:highlight (input.hidden-input)
     -3:05.7.0 settings-view:open (input.hidden-input)
     -2:24.6.0 intentions:highlight (input.hidden-input)
     -2:24.6.0 core:select-all (input.hidden-input)
     -2:18.1.0 atom-beautify:beautify-editor (div.line)
     -2:14.3.0 intentions:highlight (input.hidden-input)
     -2:14.2.0 core:select-all (input.hidden-input)
 14x -0:21.7.0 core:backspace (input.hidden-input)

Non-Core Packages

ask-stack 2.2.0
atom-beautify 0.33.4
atom-clock 0.1.17
atom-csv-markdown 1.0.2
atom-material-syntax 1.0.8
atom-material-ui 2.1.3
atom-math 0.0.9
atom-path-intellisense 1.2.1
atom-python-run 0.9.7
atom-twitter-client 0.4.5
autocomplete 0.47.0
autocomplete-mathjax 0.1.1
autocomplete-paths 2.12.2
browser-plus 0.0.98
busy-signal 2.0.1
color-picker 2.3.0
default-language 0.3.1
emmet 2.4.3
file-icons 2.1.36
file-templates 0.2.0
gcc-make-run 0.2.12
hey-pane 1.2.0
highlight-selected 0.16.0
Hydrogen 2.13.1
intentions 1.1.5
language-batchfile 0.7.5
language-gfm-enhanced 0.92.0
language-gfm2 0.92.2
language-liquid 0.7.0
language-markdown 0.37.0
language-x86-64-assembly 2.2.11
latex 0.50.2
less-than-slash 0.19.0
lint 0.0.1
linter 2.3.1
linter-markdown 5.2.10
linter-ui-default 1.8.0
markdown-preview-enhanced 0.17.0
markdown-preview-plus 3.11.5
markdown-writer 2.11.9
minimap 4.29.9
minimap-find-and-replace 4.5.2
minimap-highlight-selected 4.6.1
minimap-pigments 0.2.2
open-in-browsers 0.0.30
pigments 0.40.2
project-manager 3.3.8
rainbow-csv 0.4.1
restart-atom 0.2.0
sentence-splitter 0.1.0
structure-view 0.2.1
tablr 1.8.3
teletype 0.13.4
tool-bar 1.2.0
tool-bar-markdown-writer 0.5.0
wordcount 3.1.0
zentabs 0.8.9
hugo13122000 commented 4 years ago

https://ibb.co/GcwLXmT (image of the error showing up)

hugo13122000 commented 4 years ago

I did some research on the web although I don't code JS, a stack overflow thread allowed me to add a line fixing the error :

i just added after line 71 :

if (elem === null) return;
function get_column_color(col_num) {
    let css_class_name = '.syntax--rainbow' + (col_num % num_rainbow_colors + 1);
    let elem = document.querySelector(css_class_name);

    if (elem === null) 
        return;

let style = getComputedStyle(elem);
    return style.color;
}

it is now working properly

EDIT : The error was linked to adding coma when there's no header yet however, this fix allows you to do so without getting an error

mechatroner commented 4 years ago

Oops... Thanks, @hugo13122000 . I made a similar quick fix which should prevent the error. I will try to find the root cause later.