Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[autocomplete-plus] the watchEditor API is broken #1224

Open
5 tasks done
asiloisad opened this issue Feb 18, 2025 · 2 comments
Open
5 tasks done

[autocomplete-plus] the watchEditor API is broken #1224

asiloisad opened this issue Feb 18, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@asiloisad
Copy link
Contributor

asiloisad commented Feb 18, 2025

Thanks in advance for your bug report!

  • Have you reproduced issue in safe mode?
  • Have you used the debugging guide to try to resolve the issue?
  • Have you checked our FAQs to make sure your question isn't answered there?
  • Have you checked to make sure your issue does not already exist?
  • Have you checked you are on the latest release of Pulsar?

What happened?

A package autocomplete-plus offers an API called watchEditor to get autocomplete function to external editors, e.g.

  • find-and-replace -> find-container
  • hydrogen-next -> watch-input
  • and more...

Stack Trace

Uncaught TypeError: Cannot read property 'getCursorBufferPosition' of undefined

At C:\Program Files\Pulsar\resources\app.asar\node_modules\autocomplete-plus\lib\subsequence-provider.js:136

TypeError: Cannot read property 'getCursorBufferPosition' of undefined
    at SubsequenceProvider.bufferToSubsequenceMatches (/app.asar/node_modules/autocomplete-plus/lib/subsequence-provider.js:136:53)
    at Array.map (<anonymous>)
    at SubsequenceProvider.getSuggestions (/app.asar/node_modules/autocomplete-plus/lib/subsequence-provider.js:258:12)
    at /app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:284:52
    at Array.forEach (<anonymous>)
    at AutocompleteManager.getSuggestionsFromProviders (/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:255:15)
    at AutocompleteManager.findSuggestions (/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:247:17)
    at AutocompleteManager.requestNewSuggestions (/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:702:12)
    at AutocompleteManager.showOrHideSuggestionListForBufferChanges (/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:768:12)
    at Function.simpleDispatch (/app.asar/node_modules/event-kit/dist/emitter.js:64:14)
    at Emitter.emit (/app.asar/node_modules/event-kit/dist/emitter.js:257:28)
    at TextBuffer.emitDidChangeTextEvent (/app.asar/node_modules/text-buffer/lib/text-buffer.js:2374:24)
    at TextBuffer.transact (/app.asar/node_modules/text-buffer/lib/text-buffer.js:1337:10)
    at TextEditor.transact (/app.asar/src/text-editor.js:2467:24)
    at /app.asar/src/text-editor.js:1799:19
    at TextEditor.mergeSelections (/app.asar/src/text-editor.js:4053:20)
    at TextEditor.mergeIntersectingSelections (/app.asar/src/text-editor.js:4015:10)
    at TextEditor.mutateSelectedText (/app.asar/src/text-editor.js:1798:17)
    at TextEditor.insertText (/app.asar/src/text-editor.js:1747:25)
    at TextEditorComponent.didTextInput (/app.asar/src/text-editor-component.js:1845:24)

It look like the problem is SubsequenceProvider expect that all editors are regirestred to atom.workspace, because then it's try to restore editor from buffer.

I see two possible solutions:

Pulsar version

1.124.0

Which OS does this happen on?

🪟 Windows

OS details

10

Which CPU architecture are you running this on?

x86_64/AMD64

What steps are needed to reproduce this?

  1. Go to settings of find-and-replace package.`
  2. Activate Autocomplete Search
  3. Open any text editor
  4. Open find-and-replace window
  5. Type 3 or more characters (to trigger autocomplete)

Additional Information:

atom/autocomplete-plus#872

@asiloisad asiloisad added the bug Something isn't working label Feb 18, 2025
@savetheclocktower
Copy link
Contributor

The subsequence provider is a barely useful fallback provider used when you don't have something smarter. It just suggests words that have already been typed in the buffer — even less useful when you're in an external editor. If I had my way it wouldn't be enabled at all, so one option would be to disable it for mini editors, or at least have it fail gracefully when it can't find the editor in atom.workspace.

@asiloisad
Copy link
Contributor Author

I have dig it more and an issue occurs only if config includeCompletionsFromAllBuffers is set to false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants