This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 645
add go.mod and go.sum support #2344
Merged
ramya-rao-a
merged 2 commits into
microsoft:master
from
calebdoxsey:module-language-support
Mar 2, 2019
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
{ | ||
"scopeName": "go.mod", | ||
"patterns": [ | ||
{ | ||
"include": "#comments" | ||
}, | ||
{ | ||
"include": "#directive" | ||
} | ||
], | ||
"repository": { | ||
"directive": { | ||
"patterns": [ | ||
{ | ||
"comment": "Multi-Line directive", | ||
"begin": "(\\w+)\\s+\\(", | ||
"beginCaptures": { | ||
"1": { | ||
"name": "keyword.go.mod" | ||
} | ||
}, | ||
"end": "\\)", | ||
"patterns": [ | ||
{ | ||
"include": "#arguments" | ||
} | ||
] | ||
}, | ||
{ | ||
"comment": "Single-Line directive", | ||
"match": "(\\w+)\\s+(.*)", | ||
"captures": { | ||
"1": { | ||
"name": "keyword.go.mod" | ||
}, | ||
"2": { | ||
"patterns": [ | ||
{ | ||
"include": "#arguments" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"arguments": { | ||
"patterns": [ | ||
{ | ||
"include": "#comments" | ||
}, | ||
{ | ||
"include": "#double_quoted_string" | ||
}, | ||
{ | ||
"include": "#raw_quoted_string" | ||
}, | ||
{ | ||
"include": "#operator" | ||
}, | ||
{ | ||
"include": "#semver" | ||
}, | ||
{ | ||
"include": "#unquoted_string" | ||
} | ||
] | ||
}, | ||
"comments": { | ||
"patterns": [ | ||
{ | ||
"begin": "//", | ||
"beginCaptures": { | ||
"0": { | ||
"name": "punctuation.definition.comment.go.mod" | ||
} | ||
}, | ||
"end": "$", | ||
"name": "comment.line.double-slash.go.mod" | ||
} | ||
] | ||
}, | ||
"operator": { | ||
"match": "(=>)", | ||
"name": "operator.go.mod" | ||
}, | ||
"unquoted_string": { | ||
"comment": "Unquoted string", | ||
"match": "[^\\s]+", | ||
"name": "string.unquoted.go.mod" | ||
}, | ||
"double_quoted_string": { | ||
"comment": "Interpreted string literals", | ||
"begin": "\"", | ||
"beginCaptures": { | ||
"0": { | ||
"name": "punctuation.definition.string.begin.go.mod" | ||
} | ||
}, | ||
"end": "\"", | ||
"endCaptures": { | ||
"0": { | ||
"name": "punctuation.definition.string.end.go.mod" | ||
} | ||
}, | ||
"name": "string.quoted.double", | ||
"patterns": [ | ||
{ | ||
"include": "#string_escaped_char" | ||
}, | ||
{ | ||
"include": "#string_placeholder" | ||
} | ||
] | ||
}, | ||
"raw_quoted_string": { | ||
"comment": "Raw string literals", | ||
"begin": "`", | ||
"beginCaptures": { | ||
"0": { | ||
"name": "punctuation.definition.string.begin.go.mod" | ||
} | ||
}, | ||
"end": "`", | ||
"endCaptures": { | ||
"0": { | ||
"name": "punctuation.definition.string.end.go.mod" | ||
} | ||
}, | ||
"name": "string.quoted.raw", | ||
"patterns": [ | ||
{ | ||
"include": "#string_placeholder" | ||
} | ||
] | ||
}, | ||
"semver": { | ||
"comment": "Semver version strings (v1.2.3)", | ||
"match": "v(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-[\\da-z-]+(?:\\.[\\da-z-]+)*)?(?:\\+[\\da-z-]+(?:\\.[\\da-z-]+)*)?", | ||
"name": "constant.language.go.mod" | ||
}, | ||
"string_escaped_char": { | ||
"patterns": [ | ||
{ | ||
"match": "\\\\([0-7]{3}|[abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})", | ||
"name": "constant.character.escape.go.mod" | ||
}, | ||
{ | ||
"match": "\\\\[^0-7xuUabfnrtv\\'\"]", | ||
"name": "invalid.illegal.unknown-escape.go.mod" | ||
} | ||
] | ||
}, | ||
"string_placeholder": { | ||
"patterns": [ | ||
{ | ||
"match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGsp]", | ||
"name": "constant.other.placeholder.go.mod" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"scopeName": "go.sum", | ||
"patterns": [ | ||
{ | ||
"include": "#checksum" | ||
}, | ||
{ | ||
"include": "#semver" | ||
}, | ||
{ | ||
"include": "#unquoted_string" | ||
} | ||
], | ||
"repository": { | ||
"checksum": { | ||
"comment": "Checksum", | ||
"match": "h1:([^\\s]+)=", | ||
"captures": { | ||
"1": { | ||
"patterns": [ | ||
{ | ||
"match": "[a-zA-Z\\d+\\/]{43}", | ||
"name": "string.unquoted.go.sum" | ||
}, | ||
{ | ||
"match": ".*", | ||
"name": "invalid.illegal.unknown-hash.go.sum" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"semver": { | ||
"comment": "Semver version strings (v1.2.3)", | ||
"match": "v(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-[\\da-z-]+(?:\\.[\\da-z-]+)*)?(?:\\+[\\da-z-]+(?:\\.[\\da-z-]+)*)?", | ||
"name": "constant.language.go.sum" | ||
}, | ||
"unquoted_string": { | ||
"comment": "Unquoted string", | ||
"match": "[^\\s]+", | ||
"name": "string.unquoted.go.sum" | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the "official" regexp is:
^v[0-9]+\.(0\.0-|\d+\.\d+-([^+]*\.)?0\.)\d{14}-[A-Za-z0-9]+(\+incompatible)?$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's for the special pseudo version: https://tip.golang.org/cmd/go/#hdr-Pseudo_versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I agree about using that regex instead - I wrote one by hand on the Atom repo, but we may want to just use the same regex as the one the language uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is it only matches pseudo versions:
v0.0.0-20161113214103-89cd22812c4f
It won't match
v1.2.3
At least that's how I read the regex. Is there another one that matches both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right - the code they use to validate the semver is here.
In testing out your branch locally I didn't experience any problems.