Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
/language-phpPublic archive

Fix attributes with leading whitespaces#411

Merged
sadick254 merged 1 commit intoatom:masterfromKapitanOczywisty:FixAttributes
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix attributes with leading whitespaces
  • Loading branch information
@KapitanOczywisty
KapitanOczywisty committedJan 7, 2021
commit48abde627da2406b92162230e1b3a3407db23c8a
2 changes: 1 addition & 1 deletiongrammars/php.cson
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1188,7 +1188,7 @@
]
}
{
'begin': '(^\\s+)?(?=#)'
'begin': '(^\\s+)?(?=#)(?!#\\[)'
'beginCaptures':
'1':
'name': 'punctuation.whitespace.comment.leading.php'
Expand Down
17 changes: 17 additions & 0 deletionsspec/php-spec.coffee
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2151,6 +2151,23 @@ describe 'PHP grammar', ->
expect(tokens[4]).toEqual value: 'class', scopes: ['source.php', 'meta.class.php', 'storage.type.class.php']
expect(tokens[6]).toEqual value: 'Foo', scopes: ['source.php', 'meta.class.php', 'entity.name.type.class.php']

it 'should tokenize attribute for method', ->
lines = grammar.tokenizeLines '''
class Foo {
#[ExampleAttribute]
public function bar() {}
# I'm a happy comment!
public function baz() {}
}
'''

expect(lines[1][1]).toEqual value: '#[', scopes: ['source.php', 'meta.class.php', 'meta.class.body.php', 'meta.attribute.php']
expect(lines[1][2]).toEqual value: 'ExampleAttribute', scopes: ['source.php', 'meta.class.php', 'meta.class.body.php', 'meta.attribute.php', 'support.attribute.php']
expect(lines[1][3]).toEqual value: ']', scopes: ['source.php', 'meta.class.php', 'meta.class.body.php', 'meta.attribute.php']
expect(lines[3][0]).toEqual value: ' ', scopes: ['source.php', 'meta.class.php', 'meta.class.body.php', 'punctuation.whitespace.comment.leading.php']
expect(lines[3][1]).toEqual value: '#', scopes: ['source.php', 'meta.class.php', 'meta.class.body.php', 'comment.line.number-sign.php', 'punctuation.definition.comment.php']
expect(lines[3][2]).toEqual value: ' I\'m a happy comment!', scopes: ['source.php', 'meta.class.php', 'meta.class.body.php', 'comment.line.number-sign.php']

it 'should tokenize attribute with namespace', ->
{tokens} = grammar.tokenizeLine '#[Foo\\Bar\\Attribute]'

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp