Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
georgewfraser committed May 26, 2019
1 parent 6d13398 commit f835b77
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ function colorGo(root: Parser.SyntaxNode, editor: vscode.TextEditor) {
} else if (x.type == 'type_identifier') {
// x: type
colors.push([x, 'entity.name.type'])
} else if (x.type == 'field_identifier' && x.parent!.type == 'selector_expression' && scope.isPackage(x.parent!.firstChild!.text)) {
// pkg.member
} else if (x.type == 'field_identifier') {
// pkg.member
const isPackage = x.parent!.type == 'selector_expression' && scope.isPackage(x.parent!.firstChild!.text)
// obj.member
colors.push([x, 'variable'])
if (!isPackage) colors.push([x, 'variable'])
}
}
function updateScope(x: Parser.SyntaxNode, scope: Scope) {
Expand Down Expand Up @@ -351,7 +351,7 @@ function createDecorationFromTextmate(themeStyle: colors.TextMateRuleSettings):
async function loadStyles() {
await colors.load()
// Clear old styles
for (let style of decorationCache.values()) {
for (const style of decorationCache.values()) {
style.dispose()
}
decorationCache.clear()
Expand Down

0 comments on commit f835b77

Please sign in to comment.