atom / language-go

Go language package for Atom
Other
106 stars 65 forks source link

Detect %w as a string placeholder #179

Closed dhowden closed 5 years ago

dhowden commented 5 years ago

Description of the Change

Make %w a recognised string placeholder.

Go 1.13 includes support for %w in calls to fmt.Errorf for wrapping errors. Currently the language syntax doesn't identify it as a valid string placeholder.

Alternate Designs

Do nothing.

Benefits

Correctly highlight the placeholder for fmt.Errorf.

Possible Drawbacks

Will incorrectly highlight %w in other strings, as it is only valid in fmt.Errorf calls at the moment. Not straightforward to implement this without some edge cases.

Applicable Issues

https://github.com/microsoft/vscode-go/issues/2819

Tests

Tested this locally (in TextMate).

dhowden commented 5 years ago

Apologies, realised there are tests for this that I can add to! Will add another commit with tests.

rsese commented 5 years ago

Thanks for the contribution!

As you may have heard, we are migrating from our old first-mate grammar engine to the new Tree-sitter engine. This will enable a number of new features, more consistent syntax highlighting, and better performance, among other benefits. In order to free up our limited resources, we have decided to stop maintaining the first-mate grammar when there is a built-in Tree-sitter grammar available.

Since this pull request is specific to the first-mate grammar we're going to close it, but thanks again for the contribution.

We've mentioned this to the VS Code folks and I believe in some cases they're using a fork or some other repository for a particular language's syntax highlighting but you would need to ask them if that's the case with Go.