issue on the emmet package
Thanks in advance for your bug report!
- [X] Have you reproduced issue in safe mode?
- [X] Have you used the debugging guide to try to resolve the issue?
- [X] Have you checked our FAQs to make sure your question isn't answered there?
- [X] Have you checked to make sure your issue does not already exist?
- [X] Have you checked you are on the latest release of Pulsar?
What happened?
After using an emmet shortcut, an error is generated when pressing the TAB key
Pulsar version
latest
Which OS does this happen on?
🐧 Debian based (Linux Mint, Ubuntu, etc.)
OS details
24.10
Which CPU architecture are you running this on?
x86_64/AMD64
What steps are needed to reproduce this?
- Use any emmet shortcut
- Press TAB to indent
- Get an error and TAB action is ignored
Additional Information:
Stack Trace
Uncaught TypeError: Cannot read property 'length' of undefined
At /opt/Pulsar/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1323
TypeError: Cannot read property 'length' of undefined
at runAction (/packages/emmet/lib/emmet.coffee:79:51)
at /packages/emmet/lib/emmet.coffee:62:9
at Object.exec (/packages/emmet/lib/editor-proxy.coffee:80:10)
at /packages/emmet/lib/emmet.coffee:61:19
at TextBuffer.transact (/app.asar/node_modules/text-buffer/lib/text-buffer.js:1320:16)
at TextEditor.transact (/app.asar/src/text-editor.js:2467:24)
at /packages/emmet/lib/emmet.coffee:60:24)
at CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:405:43)
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:617:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:408:22)
at WindowEventHandler.handleDocumentKeyEvent (/app.asar/src/window-event-handler.js:153:34)
Commands
-2:27.1.0 core:cut (input.hidden-input)
-2:22.2.0 core:save (input.hidden-input)
-2:13.3.0 emmet:expand-abbreviation-with-tab (input.hidden-input)
-2:11.8.0 core:backspace (input.hidden-input)
-2:08.8.0 ftp-remote-edit:open-file (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui)
-2:05.3.0 emmet:expand-abbreviation-with-tab (input.hidden-input)
-2:00.8.0 emmet:expand-abbreviation (input.hidden-input)
-1:59.9.0 emmet:insert-formatted-line-break-only (input.hidden-input)
-1:58.5.0 emmet:expand-abbreviation-with-tab (input.hidden-input)
5x -1:55.9.0 core:undo (input.hidden-input)
-1:49.1.0 emmet:expand-abbreviation-with-tab (input.hidden-input)
-1:41.5.0 core:save (input.hidden-input)
-0:08.0 emmet:expand-abbreviation-with-tab (input.hidden-input)
Error on pop-up
/opt/Pulsar/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1323
[Hide Stack Trace](https://github.com/pulsar-edit/pulsar/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=bug-report.yml#)
TypeError: Cannot read property 'length' of undefined
at runAction (/home/USER/.pulsar/packages/emmet/lib/emmet.coffee:79:51)
at /home/USER/.pulsar/packages/emmet/lib/emmet.coffee:62:9
at Object.exec (/home/USER/.pulsar/packages/emmet/lib/editor-proxy.coffee:80:10)
at /home/USER/.pulsar/packages/emmet/lib/emmet.coffee:61:19
at TextBuffer.transact (/opt/Pulsar/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1320:16)
at TextEditor.transact (/opt/Pulsar/resources/app.asar/src/text-editor.js:2467:24)
at HTMLElement.<anonymous> (/home/USER/.pulsar/packages/emmet/lib/emmet.coffee:60:24)
at CommandRegistry.handleCommandEvent (/opt/Pulsar/resources/app.asar/src/command-registry.js:405:43)
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/opt/Pulsar/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:617:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/opt/Pulsar/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:408:22)
at WindowEventHandler.handleDocumentKeyEvent (/opt/Pulsar/resources/app.asar/src/window-event-handler.js:153:34)
Non-Core Packages
atom-beautify 0.33.4
emmet 2.4.3
ftp-remote-edit 0.20.0
minimap 4.40.1
me too pulsar 1.124.2024121606 emmet 2.4.3 ubuntu 22.04.5
The emmet package is archived so i forked and solved. Here is the issue with my fix.
The emmet package is archived so i forked and solved. Here is the issue with my fix.
@backit Any chance you could request that your fork be added to the community packages repo? I'm using Pulsar with some novice web design students this coming semester and I'd like to have them work with Emmet. It'd be super helpful to have a one-click install of your fork available so I don't have to instruct all of them (at this early stage of their journey, when they all still have math anxiety about the terminal) in installing npm or adding packages via the command line. We'll get to that stuff, but they're not there yet. :-)
Sorry this took so long to address, but I realized this could be fixed on our side by three lines of code; better to do that than to assign a chore to all emmet users. (This has also been broken since I broke it in atom#312; and while that's emmet’s fault for making assumptions about the implementation details of snippets, it also makes it poetic that I'm the one to fix it.)
#1334 has the fix. If you want a way to test out the approach of that fix without checking out pulsar and running it in dev mode, you can follow these instructions to add some weird JS to your init.js and achieve the same effect. (Just remember to remove that JS after you confirm that it fixes the issue, because that's not a great thing to leave in your init file and forget about.)