| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -120,14 +120,10 @@ scopes: | |||
| 120 | 120 | '"while"': 'keyword.control' | |
| 121 | 121 | '"in"': 'keyword.control' | |
| 122 | 122 | '"until"': 'keyword.control' | |
| 123 | - '"alias"': 'keyword.control' | ||
| 124 | 123 | '"defined?"': 'keyword.control' | |
| 125 | - '"redo"': 'keyword.control' | ||
| 126 | - '"super"': 'keyword.control' | ||
| 124 | + '"alias"': 'keyword.control' | ||
| 127 | 125 | '"undef"': 'keyword.control' | |
| 128 | - '"alias_method"': 'keyword.control' | ||
| 129 | - '"block_given?"': 'keyword.control' | ||
| 130 | - '"iterator?"': 'keyword.control' | ||
| 126 | + 'super': 'keyword.control' | ||
| 131 | 127 | ||
| 132 | 128 | 'interpolation': 'embedded.source' | |
| 133 | 129 | 'interpolation > "#{"': 'punctuation.section.embedded' | |
@@ -149,6 +145,10 @@ scopes: | |||
| 149 | 145 | match: '^(public|protected|private)$' | |
| 150 | 146 | scopes: 'keyword.other.special-method' | |
| 151 | 147 | } | |
| 148 | + { | ||
| 149 | + match: '^(block_given\?|iterator\?|alias_method|redo)' | ||
| 150 | + scopes: 'keyword.control' | ||
| 151 | + } | ||
| 152 | 152 | ] | |
| 153 | 153 | ||
| 154 | 154 | 'escape_sequence': 'constant.character.escape' | |
@@ -167,6 +167,7 @@ scopes: | |||
| 167 | 167 | 'method_call > identifier:nth-child(0)': [ | |
| 168 | 168 | {exact: 'require', scopes: 'support.function'} | |
| 169 | 169 | {match: '^(public|protected|private)$', scopes: 'keyword.other.special-method'} | |
| 170 | + {match: '^(block_given\?|iterator\?|alias_method|redo)', scopes: 'keyword.control'} | ||
| 170 | 171 | 'entity.name.function' | |
| 171 | 172 | ] | |
| 172 | 173 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,4 +55,60 @@ describe('Tree-sitter Ruby grammar', () => { | |||
| 55 | 55 | '.source.ruby .keyword.other.special-method' | |
| 56 | 56 | ) | |
| 57 | 57 | }) | |
| 58 | + | ||
| 59 | + it('tokenizes keyword predicates', async () => { | ||
| 60 | + const editor = await atom.workspace.open('foo.rb') | ||
| 61 | + | ||
| 62 | + editor.setText(dedent` | ||
| 63 | + defined?(:thing) | ||
| 64 | + block_given? | ||
| 65 | + iterator? | ||
| 66 | + `) | ||
| 67 | + | ||
| 68 | + expect(editor.scopeDescriptorForBufferPosition([0, 0]).toString()).toBe( | ||
| 69 | + '.source.ruby .keyword.control' | ||
| 70 | + ) | ||
| 71 | + expect(editor.scopeDescriptorForBufferPosition([1, 0]).toString()).toBe( | ||
| 72 | + '.source.ruby .keyword.control' | ||
| 73 | + ) | ||
| 74 | + expect(editor.scopeDescriptorForBufferPosition([2, 0]).toString()).toBe( | ||
| 75 | + '.source.ruby .keyword.control' | ||
| 76 | + ) | ||
| 77 | + }) | ||
| 78 | + | ||
| 79 | + it('tokenizes alias definitions', async () => { | ||
| 80 | + const editor = await atom.workspace.open('foo.rb') | ||
| 81 | + | ||
| 82 | + editor.setText(dedent` | ||
| 83 | + alias_method :name, :full_name | ||
| 84 | + alias name full_name | ||
| 85 | + `) | ||
| 86 | + | ||
| 87 | + expect(editor.scopeDescriptorForBufferPosition([0, 0]).toString()).toBe( | ||
| 88 | + '.source.ruby .keyword.control' | ||
| 89 | + ) | ||
| 90 | + expect(editor.scopeDescriptorForBufferPosition([1, 0]).toString()).toBe( | ||
| 91 | + '.source.ruby .keyword.control' | ||
| 92 | + ) | ||
| 93 | + }) | ||
| 94 | + | ||
| 95 | + it('tokenizes keywords', async () => { | ||
| 96 | + const editor = await atom.workspace.open('foo.rb') | ||
| 97 | + | ||
| 98 | + editor.setText(dedent` | ||
| 99 | + undef | ||
| 100 | + redo | ||
| 101 | + super | ||
| 102 | + `) | ||
| 103 | + | ||
| 104 | + expect(editor.scopeDescriptorForBufferPosition([0, 0]).toString()).toBe( | ||
| 105 | + '.source.ruby .keyword.control' | ||
| 106 | + ) | ||
| 107 | + expect(editor.scopeDescriptorForBufferPosition([1, 0]).toString()).toBe( | ||
| 108 | + '.source.ruby .keyword.control' | ||
| 109 | + ) | ||
| 110 | + expect(editor.scopeDescriptorForBufferPosition([2, 0]).toString()).toBe( | ||
| 111 | + '.source.ruby .keyword.control' | ||
| 112 | + ) | ||
| 113 | + }) | ||
| 58 | 114 | }) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments