Git Product home page Git Product logo

Comments (5)

hrsh7th avatar hrsh7th commented on September 21, 2024 1

If we provide the below config, I think this features can be implemented (but it is not a general solution, I think)

let g:compe_path_alias = {
\   '@': { bufnr -> SomeYourProjectRootDetection(bufnr) . '/src' },
\ }

from nvim-compe.

hrsh7th avatar hrsh7th commented on September 21, 2024

Do you know the some other completion-engine that realized it?
If so, I want to ask you about it.

In my impression, it is difficult in general solution.

from nvim-compe.

elianiva avatar elianiva commented on September 21, 2024

There's no completion that does this as far as I'm aware. So this might be impossible to do, even if it's possible then it might be difficult.

Just asking, how do compe-nvim generate path completion? Is it reading the previous word and then gives the autocomplete items? I have an idea to replace the alias to a certain word and then lookup on that directory, but I don't know if this will work or not, just a thought on my head.

If that wouldn't work either, feel free to close this issue. It's not that I really want it but it's a nice thing to have, just curious if it's actually possible or not. Thanks!

from nvim-compe.

elianiva avatar elianiva commented on September 21, 2024

Yeah, defining it manually is not a good solution in my opinion but that's doable. I'll try to play around with it to see if I can come up with something. I don't think it is worthy enough to merge it into master though since only a fraction amount of people that uses it, including me.
Closing this issue for now.

from nvim-compe.

hrsh7th avatar hrsh7th commented on September 21, 2024

I had considered it before.

In my previous thoughts, it is absolute path mode.

For example, Your suggested example is converting @/components/stu to %ROOT%/src/components/stu.

We can think it is an upward search for project structure.

/%ROOT%
    /src
        /components
            /student
                index.tsx
            /school
                index.tsx
        /app
            index.tsx

In /app/index.tsx, @/components/stu is ../components/stu.
In /components/school/index.tsx, @/components/stu is ../../components/stu.

But this solution makes unexpected behavior if /src/components/components/school/index.tsx is existing.

Probably, this solution can be a general solution with more careful consideration.

from nvim-compe.

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.