Git Product home page Git Product logo

Comments (6)

joverbey avatar joverbey commented on May 26, 2024

@rdallman I've been thinking about this for a few weeks.

If there is a single main file/function, so we can set the scope to that. The Go repo, for example, has a cmd directory with several different commands, so there are actually several main programs in that repo.

If we can find the repo root, it wouldn't be hard to parse through the source files, find all of the files in the main package, and use those to set the scope. But we'd want to put this on a timeout -- don't search for more than, say, one second.

I haven't touched go/loader in a couple of years and forgot how it works (or doesn't). Do you have a sense of how well things work if we prime the loader with main functions vs. the repo root directory?

I think Rename is the only refactoring where scope really matters, since we look for references across multiple files. The other refactorings only modify a single file.

from godoctor.

rdallman avatar rdallman commented on May 26, 2024

This needs to be updated for modules and get rid of the GOPATH lingo, reminding myself to at least update the README instructions. now we can probably crawl up to the root module which is probably the same thing as the git root (just need to get rid of GOPATH to deduce)

from godoctor.

sorenisanerd avatar sorenisanerd commented on May 26, 2024

Or go.mod, whichever comes first?

from godoctor.

sorenisanerd avatar sorenisanerd commented on May 26, 2024

Even though git most certainly has won the VCS war, it feels wrong to me to have that be a requirement.

from godoctor.

sorenisanerd avatar sorenisanerd commented on May 26, 2024

Is it really too much to ask for people to run godoctor from the root of their workspace, and if they can't, then explicity provide it? That's what gopls does, as far as I can tell.

from godoctor.

rdallman avatar rdallman commented on May 26, 2024

yea this is more of a convenience, none of this is defaulted or required. we do require setting scope to run a refactoring, I'm mostly referring to updating https://github.com/godoctor/godoctor.vim/#setting-scope-to-git-root in my comment, which is flexible and still allows setting scope per refactoring - I agree yea, want to change lingo to look for go.mod rather than .git once this all works.

from godoctor.

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.