Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When working with a Token, it would be useful to know which Language it came from #48

Open
dvclmn opened this issue Sep 10, 2024 · 1 comment

Comments

@dvclmn
Copy link

dvclmn commented Sep 10, 2024

Token provides a name and range property, but there is currently no way to verify which language configuration is providing which token.

let provider: TokenAttributeProvider = { token in
      
    print("Token: \(token)")

    return switch token.name {
        case let keyword where keyword == "punctuation.delimiter": [.foregroundColor: NSColor.red]
        case let keyword where keyword == "text.title": [.foregroundColor: NSColor.green]
        default: [.foregroundColor: NSColor.blue]
    }
}
@mattmassicotte
Copy link
Contributor

Ok, this is complex. The tokens are delivered are merged across all layers, so the information is lost by this point. Preserving it requires changing how layer cursors work. But I like the idea and its been a problem for me in the past too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants