aki77 / atom-expand-region

expanding selection
https://atom.io/packages/expand-region
MIT License
89 stars 9 forks source link

Uncaught TypeError: languageMode.rowRangeForFoldAtBufferRow is not a function #29

Closed styx closed 6 years ago

styx commented 6 years ago

Steps to reproduce:

  1. Setup 1.22.0-beta0
  2. option+arrow up

Atom: 1.22.0-beta0 x64 Electron: 1.6.9 OS: Mac OS X 10.12.6 Thrown From: expand-region package 0.3.2

Stack Trace

Uncaught TypeError: languageMode.rowRangeForFoldAtBufferRow is not a function

At /Applications/Atom Beta.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:959

TypeError: languageMode.rowRangeForFoldAtBufferRow is not a function
    at Function.module.exports.Selector.selectFold (/packages/expand-region/lib/selector.coffee:47:7)
    at /packages/expand-region/lib/selector.coffee:13:7
    at /Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:2558:19
    at TextEditor.module.exports.TextEditor.mergeSelections (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:2635:24)
    at TextEditor.module.exports.TextEditor.mergeIntersectingSelections (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:2597:41)
    at TextEditor.module.exports.TextEditor.expandSelectionsForward (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:2552:25)
    at Function.module.exports.Selector.select (/packages/expand-region/lib/selector.coffee:12:12)
    at /packages/expand-region/lib/main.coffee:32:56)
    at CommandRegistry.handleCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:381:36)
    at CommandRegistry.dispatch (/Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:266:23)
    at /packages/expand-region/lib/expand-region.coffee:113:21
    at TextBuffer.module.exports.TextBuffer.transact (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:952:24)
    at TextEditor.module.exports.TextEditor.transact (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:1687:32)
    at ExpandRegion.module.exports.ExpandRegion.computeRanges (/packages/expand-region/lib/expand-region.coffee:112:13)
    at ExpandRegion.module.exports.ExpandRegion.computeCandidates (/packages/expand-region/lib/expand-region.coffee:65:7)
    at ExpandRegion.module.exports.ExpandRegion.expand (/packages/expand-region/lib/expand-region.coffee:16:20)
    at /packages/expand-region/lib/expand-region.coffee:1:1)
    at CommandRegistry.handleCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:381:36)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/window-event-handler.js:100:42)
    at HTMLDocument.<anonymous> (/Applications/Atom Beta.app/Contents/Resources/app/src/window-event-handler.js:3:65)

Commands

     -0:39.5.0 vim-mode-plus:insert-below-with-newline (input.hidden-input)
     -0:38.7.0 vim-mode-plus:activate-normal-mode (input.hidden-input)
     -0:38.5.0 core:save (input.hidden-input)
  2x -0:37.3.0 vim-mode-plus:move-up (input.hidden-input)
     -0:34.8.0 intentions:highlight (input.hidden-input)
     -0:34.6.0 datatip:toggle (input.hidden-input)
     -0:18.4.0 editor:move-line-up (input.hidden-input)
     -0:17.5.0 editor:move-line-down (input.hidden-input)
     -0:16.9.0 intentions:highlight (input.hidden-input)
     -0:16.7.0 expand-region:expand (input.hidden-input)
     -0:16.7.0 editor:select-word (atom-text-editor.editor.vim-mode-plus.normal-mode.is-focused)
     -0:16.7.0 expand-region:select-word-include-dash (atom-text-editor.editor.vim-mode-plus.is-focused.normal-mode)
     -0:16.7.0 expand-region:select-word-include-dash-and-dot (atom-text-editor.editor.vim-mode-plus.is-focused.normal-mode)
     -0:16.7.0 expand-region:select-fold (atom-text-editor.editor.vim-mode-plus.is-focused.normal-mode)
     -0:16.5.0 datatip:toggle (input.hidden-input)
     -0:15.8.0 vim-mode-plus:reset-normal-mode (input.hidden-input)

Non-Core Packages

atom-beautify 0.30.5 
atom-elixir 0.2.3 
atom-jest-snippets 1.1.1 
atom-lcov 2.0.0 
atom-typescript 11.0.9 
autoclose-html 0.23.0 
build 0.69.0 
busy 0.7.0 
busy-signal 1.4.3 
clipboard-plus 0.5.1 
cucumber-step 0.2.0 
cursor-history 0.12.0 
editorconfig 2.2.2 
egghead-react-snippets 1.2.2 
erb-snippets 1.1.0 
es6-javascript 1.0.0 
exfmt-atom 0.4.5 
expand-region 0.3.2 
file-icons 2.1.12 
git-plus 7.9.3 
go-debug 1.5.2 
go-find-references 1.2.3 
go-imports 0.1.1 
go-plus 5.5.5 
go-quick-import 0.3.1 
go-rename 0.3.0 
go-signature-statusbar 1.2.3 
haskell-grammar 0.4.0 
highlight-selected 0.13.1 
intentions 1.1.5 
jump-to-import 3.5.0 
jumpy 3.1.3 
language-actionscript 0.2.0 
language-babel 2.75.1 
language-docker 1.1.8 
language-elixir 0.20.3 
language-gherkin 1.0.4 
language-nginx 0.8.0 
language-ocaml 1.9.5 
language-thrift 1.0.2 
language-x86asm 0.9.0 
last-cursor-position 0.9.2 
line-ending-converter 1.3.2 
linter 2.2.0 
linter-csslint 2.0.0 
linter-docker 0.2.1 
linter-eslint 8.3.2 
linter-flow 5.6.1 
linter-golinter 1.2.2 
linter-gotype 0.1.0 
linter-govet 0.1.5 
linter-ruby 1.2.6 
linter-ui-default 1.6.10 
nuclide 0.258.0 
open-git-modified-files 0.2.4 
open-this 0.4.0 
pigments 0.40.2 
prettier-atom 0.40.0 
pretty-json 1.6.4 
react-native-snippets 0.3.0 
ruby-block-converter 4.0.1 
ruby-syntax-replacer 0.5.1 
sort-lines 0.15.0 
tool-bar 1.1.0 
vim-mode-clipboard-plus 0.2.0 
vim-mode-plus 1.8.2 
vim-mode-plus-ex-mode 0.10.0 
vim-mode-plus-move-selected-text 0.11.0 
you-complete-me 0.8.0 
styx commented 6 years ago

Not an expert but it seems it now should be: [startRow, endRow] = editor.rowRangeForParagraphAtBufferRow(currentRow) ? []

Works for me in my fork. If it's OK I can make a PR. I only wonder, how should two Atom API version be managed?

aki77 commented 6 years ago

Thanks for the report. I will fix it when version 1.22.0 is officially released.

caleb531 commented 6 years ago

@aki77 Just upgraded to v1.22 and ran into this issue. I look forward to the upcoming fix—thanks for your work on this package!
Caleb

aki77 commented 6 years ago

Thanks for the report. Please try latest version.

caleb531 commented 6 years ago

@aki77 Works perfectly again, thanks very much ^_^