Skip to content

Expose bracket matching functionality to extensions #7177

Closed

Description

@johnfn

I'm developing a Vim extension for Visual Studio Code and I could really use your guys' bracket matching logic.

Either exposing a function like getTextDecorations() or, better yet, a function like getMatchingBracket(position: Position) would be awesome.

Thanks!

Activity

  1. added
    feature-request
    on Jun 3, 2016
  2. jrieken commented on Jun 3, 2016

    @jrieken
    Contributor
  3. removed this from the July 2016 milestone on Jul 21, 2016
  4. jrieken commented on Jul 21, 2016

    @jrieken
    Contributor

    Sorry, but that won't happen in July

  5. johnfn commented on Dec 5, 2016

    @johnfn
    ContributorAuthor

    How about December? 😉

  6. jrieken commented on Dec 5, 2016

    @jrieken
    Contributor

    How about a PR?

  7. johnfn commented on Mar 17, 2017

    @johnfn
    ContributorAuthor

    Alright, but if I make a PR on vscode you have to make a PR on vscodevim. It's only fair! 😉

  8. CoenraadS commented on Apr 8, 2017

    @CoenraadS
    Contributor

    For your proposed API getMatchingBracket(position: Position), do you expect position to already be a bracket position, or make it such that someone can put any arbitrary position in and it will return the 2 surrounding brackets of that position.

    getMatchingBracket(position: Position) : Bracket
    getSurroundingBrackets(position: Position) : BracketPair

    Thoughts on including it, or should I make a separate request/issue?

  9. CoenraadS commented on May 6, 2017

    @CoenraadS
    Contributor

    Grant Mathews (@johnfn) Is this being worked on? Else I might try it myself if its not too hard. (Not enough time)

    Johannes Rieken (@jrieken) Should API be discussed here or in PR?

  10. jrieken commented on May 8, 2017

    @jrieken
    Contributor

    Johannes Rieken (@jrieken) Should API be discussed here or in PR?

    here

  11. johnfn commented on May 8, 2017

    @johnfn
    ContributorAuthor

    No, I haven't worked on this.

    Sorry I missed your question almost a month ago. getSurroundingBrackets would be ideal.

  12. CoenraadS commented on May 8, 2017

    @CoenraadS
    Contributor
    getMatchingBracketPosition(position: Position) : Position?
    getSurroundingBracketPositions(position: Position, type?: CharacterPair) : Position[]?
    getBracketTypes() : CharacterPair[]
    

    Using the above api it would be possible to expose getting the bracket types for a document, and then being able to search surrounding brackets based on the bracket type.

    The reason for needing vscode to do this work rather then parse it extension side is because we can't tell if a bracket is in a comment or a string without having to implement language specific parsing, while we want a generic solution for all languages. I'm hoping that some of the logic in bracketMatching.ts might be able to be reused, but I'm not sure its possible to reach that code from an entry point such as ExtHostDocumentData

  13. jrieken commented on May 8, 2017

    @jrieken
    Contributor

    cc alexandrudima who knows more about this.
    CoenraadS today we have no token information in the extension host and for performance reasons have no plans yet to change that

  14. jrieken commented on Nov 17, 2017

    @jrieken
    Contributor

    This feature request will not be considered in the next 6-12 months roadmap and as such will be closed to keep the number of issues we have to maintain actionable. Thanks for understanding and happy coding!

  15. locked and limited conversation to collaborators on Jan 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apifeature-request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions