Commit Graph

81 Commits

Author SHA1 Message Date
Jerry Chen
2ffccc286f Match freestanding macros in vim syntax
Any valid name beginning with `#` that isn't already a preprocessor
macro is now considered a freestanding macro. Previously, only
preprocessor macros were handled in the vim syntax file, e.g. `#if`.

For example, this properly handles the syntax for the `#expect` and the
`#require` macros used in Swift Testing.
2025-03-08 12:46:19 -08:00
capricorn
3494a23400 [VIM] Fix syntax highlighting of nested comments
This example incorrectly highlights 'foo' as a comment:
/* // */ foo

This example does as well:
// /*
foo
*/ foo
2023-10-27 10:23:25 -06:00
Steven Wu
c1de68976f [Vim] vim syntax update for concurrency keyword
Update swift.vim to contain concurrency keywords like `async` and
`await`.
2023-10-04 09:18:29 -07:00
Saleem Abdulrasool
20dbe3fb22 vim: handle column and dsohandle identifiers 2020-06-12 10:47:36 -07:00
Saleem Abdulrasool
2b5059c204 vim: handle Any and AnyObject as core types 2020-06-12 10:47:36 -07:00
Saleem Abdulrasool
22006e376c vim: add some missing keywords for highlighting 2020-06-12 10:47:36 -07:00
Saleem Abdulrasool
1d533624c2 vim: treat associatedtype as typealias for highlighting 2020-06-12 10:47:36 -07:00
Emir Sarı
399d74ce1f Add licence notice to Vim syntax files 2020-01-21 22:00:47 +03:00
tokorom
a128b64a35 [vim] replace + to " 2019-11-18 12:40:34 -08:00
tokorom
633986e4db [vim] tidy up coding styles for syntax/swift.vim 2019-11-18 12:40:34 -08:00
Cassie Jones
fea0f4d450 Fix vim comment syntax highlighting.
This change is motivated by highlighting for
test/Interpreter/SDK/lib.swift. It contains the line

    // CHECK: the magic word is ///* magic *///

which without this change leaves the rest of the file highlighted as
commented out.  swiftComment cannot contain swiftLineComment, or else
this:

    /* // */ hello

gets incorrectly highlighted as if "hello" was commented out.
Similarly, swiftLineComment cannot contain swiftComment, or else this:

    // /*
    */

gets incorrectly highlighted as if */ was closing a comment, when
actually it should be a syntax error.
2019-07-22 10:56:52 -07:00
Saleem Abdulrasool
43d98fe8bd vim: improve attribute handling
The attribute can be applied to a typename or a type declaration.
Correct the handling for the second case.
2019-05-26 14:24:43 -07:00
Saleem Abdulrasool
69674eb95a vim: improve the modifier highlighting
This makes the modifier highlighting stand out against the definition
keyword.
2019-05-25 21:47:12 -07:00
Saleem Abdulrasool
1cede8900e vim: improve syntax highlighting for typealias
This improves the detection of syntax so that the identifier for a
typealias is identified as an identifier, the `=` is identified as a
delimiter, and the type that is aliased is identified as a type.
2019-05-24 17:40:36 -07:00
Saleem Abdulrasool
9ac6fe0137 vim: highlight lazy
`lazy` can modify the `var` definition.  Add that as a modifier.
2019-05-15 11:06:47 -07:00
Saleem Abdulrasool
5ead077f85 vim: detect prefix modifier
THe `prefix` modifier applies to prefix operators.  This is used for the
operator definitions, detect the keyword appropriately.
2018-12-31 19:28:32 -08:00
tokorom
472480c118 [vim] Fix default label problem 2018-11-21 11:14:43 +09:00
tokorom
ea2c860ddb [vim] Add swiftDefaultLabelRegion 2018-10-08 14:40:08 +09:00
tokorom
5f3775e319 [vim] Add swiftCaselLabelRegion 2018-10-08 14:37:23 +09:00
tokorom
f037b7edce [vim] add skipempty 2018-09-29 11:09:25 +09:00
tokorom
75b5c11111 [vim] remove nextgroup from swiftTupleIndexNumber 2018-09-26 07:42:29 +09:00
tokorom
fb993301c6 [vim] add swiftTupleIndexNumber 2018-09-26 07:27:40 +09:00
tokorom
b1d4b0be5d [vim] Fix tuple hilight problem with swiftType 2018-09-25 15:58:00 +09:00
tokorom
a67a37ecbb [vim] Add swiftParenthesisRegion 2018-09-25 11:22:53 +09:00
Dave Lee
24123766f6 Fix swiftPreproc regex in swift.vim (#18994) 2018-08-27 16:22:50 -07:00
Harlan
5e02d2a877 Implement #warning and #error (#14048)
* Implement #warning and #error

* Fix #warning/#error in switch statements

* Fix AST printing for #warning/#error

* Add to test case

* Add extra handling to ParseDeclPoundDiagnostic

* fix dumping

* Consume the right paren even in the failure case

* Diagnose extra tokens on the same line after a diagnostic directive
2018-02-03 18:07:05 -05:00
Brian Heim
c95598db55 Vim plugin: expand highlighting coverage (#11444)
* vim-syntax: fix highlighting for indirect case/enum

without skipwhite, `indirect enum` never gets highlighted. this
commit also adds the `indirect case` multiword keyword.

* vim-syntax: allow whitespace before type parameters

Added skipwhite to multiple match groups so that whitespace can be used
before type parameters (`Type <Param>`). This matches Xcode's behavior.

* vim-syntax: update last change line

* vim-syntax: remove indirect case from multiword type def group
2017-09-19 10:06:03 -04:00
Max Moiseev
793b86c056 [vim] Add 'open' as a modifier 2017-09-13 14:06:33 -07:00
Brian Heim
3ac7609b49 Vim: conform highlighting of preprocessor macros (#11391)
* vim-syntax: highlight #function preproc macro

* vim-syntax: highlight preproc macros in string interpolation

* vim syntax: make string interpolation a matchgroup

Now, only the opening \( and ) are highlighted, and everything inside retains its coloring
2017-08-09 16:39:45 -07:00
Saleem Abdulrasool
d45c575f8b vim: update syntax
Properly support `weak` and `indirect enum` keywords.
2017-07-19 15:29:28 -07:00
Saleem Abdulrasool
7b36b97d2d vim: remove double handling for var, let
`var` and `let` were being handled as a keyword and a variable
definition keyword.  Avoid the first match.
2017-06-09 22:52:28 -07:00
Saleem Abdulrasool
66a249ebdc vim: improve syntax highlighting for inout parameters
The `inout` keyword was not being recognised previously.  Recognise it
as a modifier for a type parameter.  It can only be used as a type
modifier.
2017-06-09 22:50:27 -07:00
Saleem Abdulrasool
46ecc9a558 vim: add didSet willSet keywords 2017-04-17 21:08:08 -07:00
Saleem Abdulrasool
041bc95c0a vim: remove typealias from keywords
It is in the tyep definition list, do not treat it as a keyword.
2016-08-24 21:02:35 -07:00
Robert Widmann
4e5665a8bd [SE-0096] Remove support for dynamicType member 2016-07-30 03:24:05 -07:00
Dmitri Gribenko
ac489860a1 vim: add support for 'fileprivate' 2016-07-28 18:30:35 -07:00
raimon
65ae9cc418 [vim] Support highlighting 'MARK' in comments 2016-07-13 22:00:52 +09:00
tokorom
f7867cedda [vim] highlight fallthrough 2016-06-05 15:15:08 +09:00
Saleem Abdulrasool
6e155f9dfd vim: highlight "indirect case" 2016-06-04 11:36:32 -07:00
Saleem Abdulrasool
799ad98b21 vim: highlight #file, #line 2016-06-04 11:35:54 -07:00
Saleem Abdulrasool
766c56f407 vim: highlight more delimiters appropriately 2016-06-04 11:35:54 -07:00
Saleem Abdulrasool
51a2df701a vim: highlight is casts 2016-06-04 11:35:54 -07:00
Saleem Abdulrasool
e8c2ad4da4 vim: remove unnecessary match duplication 2016-06-04 11:35:54 -07:00
Saleem Abdulrasool
c0a8d3f3de vim: correct categorisation of keywords
Remove modifiers from the keywords into the modifiers section.  Remove type
specifiers from the keyword group.
2016-06-04 11:35:54 -07:00
Saleem Abdulrasool
00d852d8fc vim: move remaining keywords 2016-06-04 11:35:54 -07:00
Saleem Abdulrasool
63e67590c8 vim: re-organise import keyword, component highlighting 2016-06-04 11:35:54 -07:00
Saleem Abdulrasool
91ec0e3069 vim: remove duplicate swiftFuncName
This was duplicating the swiftTypeName.  However, the swiftTypeName is more
generically named and applies to both types and functions both in structure and
usage.  Retain the single definition.
2016-06-04 11:35:54 -07:00
Saleem Abdulrasool
9a326fa50e vim: move the declaration keywords 2016-06-04 11:35:54 -07:00
Saleem Abdulrasool
3dab5cd990 vim: drop new keyword, it is obsolete 2016-06-04 11:35:54 -07:00
Saleem Abdulrasool
844a7d6381 vim: do not highlight keywords in backticks
Swift permits the use of reserved keywords as identifiers.  Reflect that in the
syntax highlighting.
2016-05-30 21:50:42 -07:00