abe33 / abe33/atom-pigments

Uncaught Error: This buffer's content is too large to fit into a string.Consider using APIs lik...

未關閉
#412 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
CoffeeScript
星號
518
分支
70
PR 合併指標
30 天內沒有已合併 PR

描述

[steps to reproduce:]

1. Open a huge sql file
2. delete a line
3. Boom ! Error.

**Atom**: 1.31.2 x64
**Electron**: 2.0.7
**OS**: Mac OS X 10.13.6
**Thrown From**: [pigments](https://github.com/abe33/atom-pigments) package 0.40.2

### Stack Trace

Uncaught Error: This buffer's content is too large to fit into a string.

Consider using APIs like `getTextInRange` to access the data you need.

```
At /Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:545

Error: This buffer's content is too large to fit into a string.

Consider using APIs like `getTextInRange` to access the data you need.
at TextBuffer.module.exports.TextBuffer.getText (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:545:94)
at TextEditor.getText (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1206:41)
at ColorBuffer.module.exports.ColorBuffer.scanBufferForVariables (/packages/pigments/lib/color-buffer.coffee:224:23)
at ColorBuffer.module.exports.ColorBuffer.update (/packages/pigments/lib/color-buffer.coffee:153:8)
at /packages/pigments/lib/color-buffer.coffee:42:12
```

### Commands

```
-0:14.5.0 core:backspace (input.hidden-input)
-0:11.2.0 core:move-down (input.hidden-input)
-0:10.5.0 core:backspace (input.hidden-input)
-0:07.7.0 core:save (input.hidden-input)
```

### Non-Core Packages

```
php-twig 4.0.0
pigments 0.40.2
```

貢獻指南

開啟貢獻指南

研究方向

The error occurs in /packages/pigments/lib/color-buffer.coffee at line 224, where scanBufferForVariables calls getText on a large buffer. Look at the TextBuffer API to replace getText with getTextInRange for large files. Test by opening a large SQL file in Atom with the pigments package and deleting a line to reproduce the crash.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
coffeescript, javascript
領域
desktop, devtools
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
描述清楚
新手友好度
40/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。