Git Product home page Git Product logo

Comments (15)

stffndtz avatar stffndtz commented on June 14, 2024

+1, had the same issue in CSS-Files

from autocomplete-paths.

doggan avatar doggan commented on June 14, 2024

👍

Same problem (in a JavaScript file) immediately after upgrading to 1.0.0.

from autocomplete-paths.

joefitzgerald avatar joefitzgerald commented on June 14, 2024

Does anyone have an example file that they can share (perhaps via a gist) that doesn't have any sensitive information? I'd like to include that file in the repo and reproduce this with a test.

from autocomplete-paths.

joefitzgerald avatar joefitzgerald commented on June 14, 2024

This looks related to #38...

from autocomplete-paths.

doggan avatar doggan commented on June 14, 2024

Here's a dummy file filled with JSON you can use to reproduce:
https://gist.github.com/doggan/11feabb4d004332f1aab

Start typing at the bottom of the file (i.e. console.log('hello world');) with autocomplete-paths enabled and you will see a noticeable delay. Disable the package and the delay disappears.

from autocomplete-paths.

joefitzgerald avatar joefitzgerald commented on June 14, 2024

It doesn't seem to be related to line count - I created a 1000 line file with 1 char on each line, then started typing on line 1001: a = https://github.com/hello. Will try with your file @doggan.

from autocomplete-paths.

joefitzgerald avatar joefitzgerald commented on June 14, 2024

Thanks, that file was helpful.

screen shot 2015-01-29 at 9 25 43 am

from autocomplete-paths.

joefitzgerald avatar joefitzgerald commented on June 14, 2024

This is weird - the size of the file really shouldn't be impacting the time taken to get through this section of code. If anything, the number of files and directories in your current directory should.

This provider should switch to being async in any case.

from autocomplete-paths.

joefitzgerald avatar joefitzgerald commented on June 14, 2024

OK, this seems to occur when there is NOT a ./ or / in front of the path on OS X. I.e. just typing "https" at the bottom of that json file reproduces it.

from autocomplete-paths.

joefitzgerald avatar joefitzgerald commented on June 14, 2024

Question: should relative paths that aren't prefixed with ./ (on OS X / Linux) or .\ (on Windows) be shown? if not, this is an easy fix.

from autocomplete-paths.

doggan avatar doggan commented on June 14, 2024

I'd say 'no'.

Seems like it would cause a lot of interference with standard autocomplete.

from autocomplete-paths.

joefitzgerald avatar joefitzgerald commented on June 14, 2024

The regex has to change. It's currently: /[a-zA-Z0-9\.\/_-]*\/[a-zA-Z0-9\.\/_-]*/g which isn't the best.

from autocomplete-paths.

joefitzgerald avatar joefitzgerald commented on June 14, 2024

The regex is doing a global match and there are no line modifiers. https://github.com/atom/atom/blob/98a874808ea00758d84bb45e0b716498d4916b5b/src/cursor.coffee#L504 dictates the start of the range to search being the last non-blank-row, which in your json = the whole document. That's badness, but not causing the issue. The issue is that the prefix could be the entire document in this scenario, which then causes path.basename / path.dirname to take an eternity.

Thanks for reporting this and figuring it out; it gives me a solid lead to create a test and then fix the issue and prevent future regression.

from autocomplete-paths.

joefitzgerald avatar joefitzgerald commented on June 14, 2024

The old code that identified the prefix constrained the search to a single line:

prefixOfSelection: (selection) ->
     selectionRange = selection.getBufferRange()
     lineRange = [[selectionRange.start.row, 0], [selectionRange.end.row, @editor.lineTextForBufferRow(selectionRange.end.row).length]]
     prefix = ""
     @editor.getBuffer().scanInRange @wordRegex, lineRange, ({match, range, stop}) ->
       stop() if range.start.isGreaterThan(selectionRange.end)

from autocomplete-paths.

doggan avatar doggan commented on June 14, 2024

Thanks for the fix @joefitzgerald! Performance issues seem to be gone. ✨

from autocomplete-paths.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.