TypeError when --cursor-offset is specified
See original GitHub issueMetadata
- Ruby version: 2.6.1p33
- @prettier/plugin-ruby version: 0.9.0
- prettier version: 1.16.4
Input
test.rb
puts 'hello world'
Current output
Command:
./node_modules/.bin/prettier test.rb --cursor-offset 0
Crash:
[error] test.rb: TypeError: options.locStart is not a function
[error] at Object.findNodeAtOffset (/Users/drp/dev-environment/node_modules/prettier/bin-prettier.js:13676:23)
[error] at coreFormat (/Users/drp/dev-environment/node_modules/prettier/bin-prettier.js:13863:32)
[error] at format (/Users/drp/dev-environment/node_modules/prettier/bin-prettier.js:14117:73)
[error] at formatWithCursor (/Users/drp/dev-environment/node_modules/prettier/bin-prettier.js:14133:12)
[error] at Object.formatWithCursor (/Users/drp/dev-environment/node_modules/prettier/bin-prettier.js:42401:15)
[error] at format$1 (/Users/drp/dev-environment/node_modules/prettier/bin-prettier.js:43770:21)
[error] at /Users/drp/dev-environment/node_modules/prettier/bin-prettier.js:43965:16
[error] at /Users/drp/dev-environment/node_modules/prettier/bin-prettier.js:43905:14
[error] at Array.forEach (<anonymous>)
[error] at eachFilename (/Users/drp/dev-environment/node_modules/prettier/bin-prettier.js:43904:15)
Expected output
puts 'hello world'
It looks like the vue plugin had a similar problem at one point (https://github.com/prettier/prettier/issues/4867) but I’m not sure whether that’s relevant.
This looks like it might be a bug in prettier itself (not the plugin), but I can’t reproduce it except on ruby files.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top Results From Across the Web
formatWithCursor issue #2131 - prettier/prettier - GitHub
prettier.formatWithCursor( ` foo('bar', cb => { console.log('stuff') })`, {cursorOffset: 24}). I get the following exception. TypeError: ...
Read more >TypeError: $(...).offset(...) is undefined and offset exists
You're calling top on offset() which is returning undefined. This leads me to believe your $(this).attr("href") value is not a valid selector, ...
Read more >FileSystemWritableFileStream.write() - Web APIs | MDN
Returned if PermissionStatus is not granted. TypeError. Returned if data is undefined, or if position or size aren't valid.
Read more >CursorPagination -- Classy DRF
Detailed descriptions, with full methods and attributes of CursorPagination Django REST Framework class.
Read more >Source code for pyqtgraph.graphicsItems.ROI
The ROI class is meant to serve as the base for more specific types; ... bool): raise TypeError("Positional arguments to setPos() must be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@cvoege I’ve been working on it but it’s been slow going. Your idea to have them as no-ops is a very good one, and I will do that and release a new version soon.
Okay friends - this functionality is going to go out in the next version
v0.13.0
. Let me know how it goes for you.