Giter Club home page Giter Club logo

Comments (5)

charlespascoe avatar charlespascoe commented on August 20, 2024

Hi! Could you clarify what you mean by 'a method from an interface'? Do you mean calling a method on an interface type, or calling a method on a type that happens to conform to some interface?

In either case, this would require type information, which isn't something Vim syntax definitions have - they're purely lexical, so highlighting is based only on the text in the file.

from vim-go-syntax.

vitaly-zdanevich avatar vitaly-zdanevich commented on August 20, 2024

Do you mean calling a method on an interface type, or calling a method on a type that happens to conform to some interface?

Both would be great.

this would require type information

Is it possible to integrate with vim-go, gopls?

from vim-go-syntax.

charlespascoe avatar charlespascoe commented on August 20, 2024

The first one (calling a method on an interface type) would require a lot of effort - even under the assumption you can get that information about a particular function call at a given location, it would still require using something like Vim's text properties to overlay custom syntax colours, which would likely result in odd highlighting artefacts when changing neighbouring code.

Now that I think about it, the second probably isn't feasible in any tolerable fashion (calling a method on a type that happens to conform to some interface) - it would require searching all available interfaces to see if one matched the call signature, which would be extremely slow even on a fast computer, and it would need to run every time the code was changed.

Overall, I don't think either of these justify the effort required to implement them, not to mention the fact that it would be special-case code that is completely separate from the rest of the syntax highlighting.

from vim-go-syntax.

vitaly-zdanevich avatar vitaly-zdanevich commented on August 20, 2024

it would require searching all available interfaces to see if one matched the call signature

Just saying, vim-go can do that.

from vim-go-syntax.

charlespascoe avatar charlespascoe commented on August 20, 2024

I hadn't used the GoImplements command before - that's cool. It's not enough by itself to do what you're asking, unfortunately.

from vim-go-syntax.

Related Issues (11)

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.