├── .github └── renovate.json ├── Changelog.md ├── README.md ├── grammars └── scala.cson ├── package.json ├── pnpm-workspace.yaml ├── settings └── language-scala.cson └── snippets └── language-scala.cson /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "schedule": ["every weekend"], 3 | "labels": ["dependencies"], 4 | "separateMajorMinor": "false", 5 | "packageRules": [ 6 | { 7 | "matchDepTypes": ["devDependencies"], 8 | "matchUpdateTypes": ["major", "minor", "patch", "pin", "digest", "lockFileMaintenance", "rollback", "bump"], 9 | "groupName": "devDependencies", 10 | "semanticCommitType": "chore", 11 | "automerge": true 12 | }, 13 | { 14 | "matchDepTypes": ["dependencies"], 15 | "matchUpdateTypes": ["major", "minor", "patch", "pin", "digest", "lockFileMaintenance", "rollback", "bump"], 16 | "groupName": "dependencies", 17 | "semanticCommitType": "fix" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /Changelog.md: -------------------------------------------------------------------------------- 1 | # Version 1.1.3 2 | - fix multiline comments (thanks @mcous) 3 | # Version 1.1.2 4 | - Added missing scaladoc `@constructor` 5 | - Fix syntax highlighting for `<-` and `->` operators. 6 | # Version 1.1.1 7 | - Fix `scoped-properties/` -> `settings/` deprecation warning 8 | # Version 1.0.1 9 | - remove sbt grammar, + toogle comments with: https://github.com/jroesch/language-scala/pull/7 10 | - Fix end match regex for import statements: https://github.com/jroesch/language-scala/pull/4 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Language support for Scala in Atom 2 | 3 | [![apm](https://img.shields.io/apm/v/language-scala.svg?style=flat-square)](https://atom.io/packages/language-scala) 4 | [![npm](https://img.shields.io/npm/v/language-scala.svg?style=flat-square)](https://www.npmjs.com/package/language-scala) 5 | 6 | [Scala grammar](https://atom.io/packages/language-scala) for [Atom](https://atom.io). Originally converted from the [Scala TextMate bundle](https://github.com/mads379/scala.tmbundle). Also available as a [Node package](https://www.npmjs.com/package/language-scala). 7 | -------------------------------------------------------------------------------- /grammars/scala.cson: -------------------------------------------------------------------------------- 1 | 'fileTypes': [ 2 | 'scala', 3 | 'sc', 4 | 'sbt' 5 | ] 6 | 'firstLineMatch': '^#!/.*\\b\\w*scala\\b' 7 | 'foldingStartMarker': '/\\*\\*|\\{\\s*$' 8 | 'foldingStopMarker': '\\*\\*/|^\\s*\\}' 9 | 'name': 'Scala' 10 | 'patterns': [ 11 | { 12 | 'include': '#interpolations' 13 | } 14 | { 15 | 'include': '#code' 16 | } 17 | ] 18 | 'repository': 19 | 'block-comments': 20 | 'begin': '/\\*' 21 | 'end': '\\*/' 22 | 'name': 'comment.block.scala' 23 | 'patterns': [ 24 | { 25 | 'include': '#block-comments' 26 | } 27 | { 28 | 'match': '(?x)\n\t\t\t(?! /\\*)\n\t\t\t(?! \\*/)\n\t\t ' 29 | } 30 | ] 31 | 'char-literal': 32 | 'begin': '\'' 33 | 'beginCaptures': 34 | '0': 35 | 'name': 'punctuation.definition.character.begin.scala' 36 | 'end': '\'(?!\')' 37 | 'endCaptures': 38 | '0': 39 | 'name': 'punctuation.definition.character.end.scala' 40 | 'name': 'constant.character.literal.scala' 41 | 'patterns': [ 42 | { 43 | 'match': '\\\\(?:[btnfr\\\\"\']|[0-7]{1,3}|u[0-9A-Fa-f]{4})' 44 | 'name': 'constant.character.escape.scala' 45 | } 46 | { 47 | 'match': '\\\\.' 48 | 'name': 'invalid.illegal.unrecognized-character-escape.scala' 49 | } 50 | { 51 | 'match': '[^\']{2,}' 52 | 'name': 'invalid.illegal.character-literal-too-long' 53 | } 54 | { 55 | 'match': '(?:|<:)' 69 | 'match': '(<%|=:=|<:<|<%<|>:|<:|\\+|\\-)' 70 | 'name': 'meta.bounds.scala' 71 | } 72 | { 73 | 'match': '(\\w+)' 74 | 'name': 'class' 75 | } 76 | ] 77 | 'interpolation-expression' : 78 | 'patterns': [ 79 | { 80 | 'name': 'source.embedded.scala' 81 | 'begin': '(\\$\\{)' 82 | 'patterns': [ 83 | { 'include': '$self' } 84 | ] 85 | 'end': '(\\})' 86 | 'captures': 87 | '0': 88 | 'name': 'punctuation.section.embedded.scala' 89 | } 90 | { 91 | 'name': 'source.embedded.scala' 92 | 'match': '(\\$)\\w+' 93 | 'captures': 94 | '1': 95 | 'name': 'punctuation.section.embedded.scala' 96 | } 97 | ] 98 | 'interpolations': 99 | 'patterns': [ 100 | { 101 | 'name': 'string.quoted.triple.scala' 102 | 'begin': '\\w+"""' 103 | 'beginCaptures': 104 | '0': 105 | 'name': 'punctuation.definition.string.begin.scala' 106 | 'end': '"""(?!")' 107 | 'endCaptures': 108 | '0': 109 | 'name': 'punctuation.definition.string.end.scala' 110 | 'patterns': [ 111 | { 'include': '#interpolation-expression' } 112 | ] 113 | } 114 | { 115 | 'name': "string.quoted.double.scala" 116 | 'begin': '\\w+"' 117 | 'beginCaptures': 118 | '0': 119 | 'name': 'punctuation.definition.string.begin.scala' 120 | 'end': '"' 121 | 'endCaptures': 122 | '0': 123 | 'name': 'punctuation.definition.string.end.scala' 124 | 'patterns': [ 125 | { 'include': '#interpolation-expression' } 126 | ] 127 | } 128 | ] 129 | 'code': 130 | 'patterns': [ 131 | { 132 | 'include': '#types' 133 | } 134 | { 135 | 'include': '#storage-modifiers' 136 | } 137 | { 138 | 'include': '#declarations' 139 | } 140 | { 141 | 'include': '#inheritance' 142 | } 143 | { 144 | 'include': '#imports' 145 | } 146 | { 147 | 'include': '#comments' 148 | } 149 | { 150 | 'include': '#block-comments' 151 | } 152 | { 153 | 'include': '#strings' 154 | } 155 | { 156 | 'include': '#initialization' 157 | } 158 | { 159 | 'include': '#xml-literal' 160 | } 161 | { 162 | 'include': '#keywords' 163 | } 164 | { 165 | 'include': '#constants' 166 | } 167 | { 168 | 'include': '#scala-symbol' 169 | } 170 | { 171 | 'include': '#char-literal' 172 | } 173 | { 174 | 'include': '#empty-parentheses' 175 | } 176 | { 177 | 'include': '#parameter-list' 178 | } 179 | { 180 | 'include': '#qualifiedClassName' 181 | } 182 | { 183 | 'include': '#meta-brackets' 184 | } 185 | { 186 | 'include': '#meta-bounds' 187 | } 188 | { 189 | 'include': '#meta-colons' 190 | } 191 | ] 192 | 'comments': 193 | 'patterns': [ 194 | { 195 | 'captures': 196 | '0': 197 | 'name': 'punctuation.definition.comment.scala' 198 | 'match': '/\\*\\*/' 199 | 'name': 'comment.block.empty.scala' 200 | } 201 | { 202 | 'begin': '^\\s*(/\\*\\*)' 203 | 'beginCaptures': 204 | '1': 205 | 'name': 'punctuation.definition.comment.scala' 206 | 'end': '\\*/' 207 | 'endCaptures': 208 | '0': 209 | 'name': 'punctuation.definition.comment.scala' 210 | 'name': 'comment.block.documentation.scala' 211 | 'patterns': [ 212 | { 213 | 'captures': 214 | '1': 215 | 'name': 'keyword.other.documentation.scaladoc.scala' 216 | '2': 217 | 'name': 'variable.parameter.scala' 218 | 'match': '(@param)\\s+(\\S+)' 219 | } 220 | { 221 | 'captures': 222 | '1': 223 | 'name': 'keyword.other.documentation.scaladoc.scala' 224 | '2': 225 | 'name': 'entity.name.class' 226 | '3': 227 | 'name': 'entity.name.description' 228 | 'match': "(@(?:tparam|throws))\\s+(\\S+)\\s+(.*)" 229 | } 230 | { 231 | 'match': '@(return|see|note|example|author|version|since|todo|deprecated|migration|define|inheritdoc|constructor)\\b' 232 | 'name': 'keyword.other.documentation.scaladoc.scala' 233 | } 234 | { 235 | 'begin': '(@usecase)\\b' 236 | 'beginCaptures': 237 | '1': 238 | 'name': 'keyword.other.documentation.scaladoc.scala.usecase' 239 | 'end': '(?<=[\\n;])' 240 | 'name': 'other.documentation.scaladoc.scala.usecase-block.embeded' 241 | 'patterns': [ 242 | { 'include': '#code' } 243 | ] 244 | } 245 | { 246 | 'captures': 247 | '1': 248 | 'name': 'punctuation.definition.documentation.link.scala' 249 | '2': 250 | 'name': 'entity.other.documentation.link.scala' 251 | '3': 252 | 'name': 'punctuation.definition.documentation.link.scala' 253 | 'match': '(\\[\\[)([^\\]]+)(\\]\\])' 254 | } 255 | { 256 | 'name': 'code-example.embedded' 257 | 'begin': '(\\{\\{\\{)' 258 | 'patterns': [ 259 | { 260 | 'name': 'margin' 261 | 'match': '^\\s*\\*' 262 | } 263 | {'include': '#code'} 264 | ] 265 | 'end': '(\\}\\}\\})' 266 | 'captures': 267 | '1': 268 | 'name': 'delimiters.scala' 269 | } 270 | ] 271 | } 272 | { 273 | 'begin': '/\\*' 274 | 'captures': 275 | '0': 276 | 'name': 'punctuation.definition.comment.scala' 277 | 'end': '\\*/' 278 | 'name': 'comment.block.scala' 279 | } 280 | { 281 | 'captures': 282 | '1': 283 | 'name': 'comment.line.double-slash.scala' 284 | '2': 285 | 'name': 'punctuation.definition.comment.scala' 286 | 'match': '\\s*((//).*$)' 287 | } 288 | ] 289 | 'constants': 290 | 'patterns': [ 291 | { 292 | 'match': '\\b(false|null|true|Nil|None)\\b' 293 | 'name': 'constant.language.scala' 294 | } 295 | { 296 | 'match': '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)([LlFfUuDd]|UL|ul)?\\b' 297 | 'name': 'constant.numeric.scala' 298 | } 299 | { 300 | 'match': '\\b(this|super|self)\\b' 301 | 'name': 'variable.language.scala' 302 | } 303 | { 304 | 'match': '\\b(Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\\b' 305 | 'name': 'storage.type.primitive.scala' 306 | } 307 | { 308 | 'match': '\\b(String|Symbol)\\b' 309 | 'name': 'storage.type.scala' 310 | } 311 | ] 312 | 'declarations': 313 | 'patterns': [ 314 | { 315 | 'captures': 316 | '1': 317 | 'name': 'keyword.declaration.scala' 318 | '2': 319 | 'name': 'entity.name.function.declaration' 320 | 'match': '(?x)\n\t\t\t\t\t\t\\b(def)\\s+\n\t\t\t\t\t\t(`[^`]+`|[_$\\p{L}][_$\\p{L}0-9]*(?:_[^\\s])(?=[(\\t ])|[_$\\p{L}][_$\\p{L}0-9]*|[!#%&*+\-/:<=>?@\\\\^|~]+)' 321 | } 322 | { 323 | 'captures': 324 | '1': 325 | 'name': 'keyword.declaration.scala' 326 | '2': 327 | 'name': 'keyword.declaration.scala' 328 | '3': 329 | 'name': 'entity.name.class.declaration' 330 | 'match': '(case)?\\b(class|trait|object)\\s+([^\\s\\{\\(\\[]+)' 331 | } 332 | { 333 | 'captures': 334 | '1': 335 | 'name': 'keyword.declaration.scala' 336 | '2': 337 | 'name': 'entity.name.type.declaration' 338 | 'match': '\\b(type)\\s+(`[^`]+`|[_$\\p{L}][_$a-z\\p{L}]*(?:_[^\\s])(?=[\\t ])|[_$\\p{L}][_$\\p{L}0-9]*|[!#%&*+\-/:<=>?@\\\\^|~]+)' 339 | } 340 | { 341 | 'captures': 342 | '1': 343 | 'name': 'keyword.declaration.stable.scala' 344 | '2': 345 | 'name': 'keyword.declaration.volatile.scala' 346 | '3': 347 | 'name': 'entity.name.val.declaration' 348 | 'match': '\\b(?:(val)|(var))\\s+(?:(`[^`]+`|[_$\\p{L}][_$\\p{L}0-9]*(?:_[^\\s])(?=[\\t ])|[_$\\p{L}][_$\\p{L}0-9]*|[!#%&*+\-/:<=>?@\\\\^|~]+)|(?=\\())' 349 | } 350 | { 351 | 'captures': 352 | '1': 353 | 'name': 'keyword.declaration.scala' 354 | '2': 355 | 'name': 'entity.name.class.declaration' 356 | 'match': '\\b(package object)\\s+([^\\s\\{\\(\\[]+)' 357 | } 358 | { 359 | 'captures': 360 | '1': 361 | 'name': 'keyword.other.scoping.scala' 362 | '2': 363 | 'name': 'entity.name.package.scala' 364 | 'match': '\\b(package)\\s+([\\w\\.]+)' 365 | 'name': 'meta.package.scala' 366 | } 367 | ] 368 | 'empty-parentheses': 369 | 'captures': 370 | '1': 371 | 'name': 'meta.bracket.scala' 372 | 'match': '(\\(\\))' 373 | 'name': 'meta.parentheses.scala' 374 | 'imports': 375 | 'begin': '\\b(import)\\s+' 376 | 'beginCaptures': 377 | '1': 378 | 'name': 'keyword.other.import.scala' 379 | 'end': '([\\n;]+)' 380 | 'name': 'meta.import.scala' 381 | 'patterns': [ 382 | { 383 | 'include': '#comments' 384 | } 385 | { 386 | 'match': '([^\\s{;.]+)\\s*\\.\\s*' 387 | 'name': 'variable.package.scala' 388 | } 389 | { 390 | 'match': '([^\\s{;.]+)\\s*[._]' 391 | 'name': 'variable.import.scala' 392 | } 393 | { 394 | 'begin': '{' 395 | 'beginCaptures': 396 | '0': 397 | 'name': 'meta.bracket.scala' 398 | 'end': '}' 399 | 'endCaptures': 400 | '0': 401 | 'name': 'meta.bracket.scala' 402 | 'name': 'meta.import.selector.scala' 403 | 'patterns': [ 404 | { 405 | 'captures': 406 | '1': 407 | 'name': 'variable.import.renamed-from.scala' 408 | '2': 409 | 'name': 'keyword.other.arrow.scala' 410 | '3': 411 | 'name': 'variable.import.renamed-to.scala' 412 | 'match': '(?x) \\s*\n\t\t\t\t([^\\s.,}]+) \\s*\n\t\t\t\t(=>) \\s*\n\t\t\t\t([^\\s.,}]+) \\s*\n\t\t\t ' 413 | } 414 | { 415 | 'match': '([^\\s.,}]+)' 416 | 'name': 'variable.import.scala' 417 | } 418 | ] 419 | } 420 | ] 421 | 'inheritance': 422 | 'patterns': [ 423 | { 424 | 'captures': 425 | '1': 426 | 'name': 'keyword.declaration.scala' 427 | '2': 428 | 'name': 'entity.other.inherited-class.scala' 429 | 'match': '(extends|with)\\s+([^\\s\\{\\(\\[\\]]+)' 430 | } 431 | ] 432 | 'initialization': 433 | 'captures': 434 | '1': 435 | 'name': 'keyword.declaration.scala' 436 | '2': 437 | 'name': 'entity.name.class' 438 | 'match': '\\b(new)\\s+([^\\s\\{\\(\\[]+)' 439 | 'keywords': 440 | 'patterns': [ 441 | { 442 | 'match': '\\b(return|throw)\\b' 443 | 'name': 'keyword.control.flow.jump.scala' 444 | } 445 | { 446 | 'match': '\\b(classOf|isInstanceOf|asInstanceOf)\\b' 447 | 'name': 'support.function.type-of.scala' 448 | } 449 | { 450 | 'match': '\\b(else|if|do|while|for|yield|match|case|until|to)\\b' 451 | 'name': 'keyword.control.flow.scala' 452 | } 453 | { 454 | 'match': '\\b(catch|finally|try)\\b' 455 | 'name': 'keyword.control.exception.scala' 456 | } 457 | { 458 | 'captures': 459 | '2': 460 | 'name': 'keyword.operator.scala' 461 | 'match': '([^!#%&*+\-/:<=>?@\\\\^|~_])(\\+\\+|:::|\\+:|::|:\\+|<-|←|->|→|=>|⇒|\\?|@)+([^!#%&*+\-/:<=>?@\\\\^|~])' 462 | } 463 | { 464 | 'captures': 465 | '2': 466 | 'name': 'keyword.operator.assignment.scala' 467 | 'match': '([^!#%&*+\-/:<=>?@\\\\^|~_])(=|\\+=|-=|\\*=|\\/=|%=|<<=|>>=|&=|\\^=|\\|=)([^!#%&*+\-/:<=>?@\\\\^|~])' 468 | } 469 | { 470 | 'captures': 471 | '2': 472 | 'name': 'keyword.operator.arithmetic.scala' 473 | 'match': '([^!#%&*+\-/:<=>?@\\\\^|~_])(\\+|-|\\*|\\/|%)+([^!#%&*+\-/:<=>?@\\\\^|~])' 474 | } 475 | { 476 | 'captures': 477 | '2': 478 | 'name': 'keyword.operator.logical.scala' 479 | 'match': '([^!#%&*+\-/:<=>?@\\\\^|~_])?(&&|\\|\\||!)+([^!#%&*+\-/:<=>?@\\\\^|~])' 480 | } 481 | { 482 | 'captures': 483 | '2': 484 | 'name': 'keyword.operator.bitwise.scala' 485 | 'match': '([^!#%&*+\-/:<=>?@\\\\^|~_])?(&|\\||\\^|~|<<|>>|>>>)+([^!#%&*+\-/:<=>?@\\\\^|~])' 486 | } 487 | { 488 | 'captures': 489 | '2': 490 | 'name': 'keyword.operator.relational.scala' 491 | 'match': '([^!#%&*+\-/:<=>?@\\\\^|~_])(==|!=|<|>|<=|>=)+([^!#%&*+\-/:<=>?@\\\\^|~])' 492 | } 493 | ] 494 | 'meta-brackets': 495 | 'comment': 'For themes: Brackets look nice when colored.' 496 | 'patterns': [ 497 | { 498 | 'match': '{|}|\\(|\\)' 499 | 'name': 'meta.bracket.scala' 500 | } 501 | ] 502 | 'meta-colons': 503 | 'comment': 'For themes: Matching type colons' 504 | 'patterns': [ 505 | { 506 | 'match': '(??@\\\\^|~]+)\\s*(:)\\s+' 520 | } 521 | ] 522 | 'qualifiedClassName': 523 | 'captures': 524 | '1': 525 | 'name': 'entity.name.class' 526 | 'match': '(\\b([A-Z][\\w]*))' 527 | 'scala-symbol': 528 | 'match': '\'\\w+(?=[^\'\\w])' 529 | 'name': 'entity.name.symbol' 530 | 'storage-modifiers': 531 | 'patterns': [ 532 | { 533 | 'match': '\\b(private\\[\\S+\\]|protected\\[\\S+\\]|private|protected)\\b' 534 | 'name': 'storage.modifier.access' 535 | } 536 | { 537 | 'match': '\\b(synchronized|@volatile|abstract|final|lazy|sealed|implicit|override|@transient|@native)\\b' 538 | 'name': 'storage.modifier.other' 539 | } 540 | ] 541 | 'strings': 542 | 'patterns': [ 543 | { 544 | 'begin': '"""' 545 | 'beginCaptures': 546 | '0': 547 | 'name': 'punctuation.definition.string.begin.scala' 548 | 'end': '"""(?!")' 549 | 'endCaptures': 550 | '0': 551 | 'name': 'punctuation.definition.string.end.scala' 552 | 'name': 'string.quoted.triple.scala' 553 | 'patterns': [ 554 | { 555 | 'match': '\\\\\\\\|\\\\u[0-9A-Fa-f]{4}' 556 | 'name': 'constant.character.escape.scala' 557 | } 558 | ] 559 | } 560 | { 561 | 'begin': '"' 562 | 'beginCaptures': 563 | '0': 564 | 'name': 'punctuation.definition.string.begin.scala' 565 | 'end': '"' 566 | 'endCaptures': 567 | '0': 568 | 'name': 'punctuation.definition.string.end.scala' 569 | 'name': 'string.quoted.double.scala' 570 | 'patterns': [ 571 | { 572 | 'match': '\\\\(?:[btnfr\\\\"\']|[0-7]{1,3}|u[0-9A-Fa-f]{4})' 573 | 'name': 'constant.character.escape.scala' 574 | } 575 | { 576 | 'match': '\\\\.' 577 | 'name': 'invalid.illegal.unrecognized-string-escape.scala' 578 | } 579 | ] 580 | } 581 | ] 582 | 'xml-doublequotedString': 583 | 'begin': '"' 584 | 'beginCaptures': 585 | '0': 586 | 'name': 'punctuation.definition.string.begin.xml' 587 | 'end': '"' 588 | 'endCaptures': 589 | '0': 590 | 'name': 'punctuation.definition.string.end.xml' 591 | 'name': 'string.quoted.double.xml' 592 | 'patterns': [ 593 | { 594 | 'include': '#xml-entity' 595 | } 596 | ] 597 | 'xml-embedded-content': 598 | 'patterns': [ 599 | { 600 | 'name': 'meta.source.embedded.scala' 601 | 'begin': '{' 602 | 'patterns': [ 603 | { 604 | 'include': '#code' 605 | } 606 | ] 607 | 'end': '}' 608 | 'captures': 609 | '0': 610 | 'name': 'meta.bracket.scala' 611 | } 612 | { 613 | 'captures': 614 | '1': 615 | 'name': 'entity.other.attribute-name.namespace.xml' 616 | '2': 617 | 'name': 'entity.other.attribute-name.xml' 618 | '3': 619 | 'name': 'punctuation.separator.namespace.xml' 620 | '4': 621 | 'name': 'entity.other.attribute-name.localname.xml' 622 | 'match': ' (?:([-_a-zA-Z0-9]+)((:)))?([_a-zA-Z-]+)=' 623 | } 624 | { 625 | 'include': '#xml-doublequotedString' 626 | } 627 | { 628 | 'include': '#xml-singlequotedString' 629 | } 630 | ] 631 | 'xml-entity': 632 | 'captures': 633 | '1': 634 | 'name': 'punctuation.definition.constant.xml' 635 | '3': 636 | 'name': 'punctuation.definition.constant.xml' 637 | 'match': '(&)([:a-zA-Z_][:a-zA-Z0-9_.-]*|#[0-9]+|#x[0-9a-fA-F]+)(;)' 638 | 'name': 'constant.character.entity.xml' 639 | 'xml-literal': 640 | 'patterns': [ 641 | { 642 | 'begin': '(<)((?:([_a-zA-Z0-9][_a-zA-Z0-9]*)((:)))?([_a-zA-Z0-9][-_a-zA-Z0-9:]*))(?=(\\s[^>]*)?>)' 643 | 'beginCaptures': 644 | '1': 645 | 'name': 'punctuation.definition.tag.xml' 646 | '3': 647 | 'name': 'entity.name.tag.namespace.xml' 648 | '4': 649 | 'name': 'entity.name.tag.xml' 650 | '5': 651 | 'name': 'punctuation.separator.namespace.xml' 652 | '6': 653 | 'name': 'entity.name.tag.localname.xml' 654 | 'comment': 'We do not allow a tag name to start with a - since this would\n\t\t\t\t likely conflict with the <- operator. This is not very common\n\t\t\t\t for tag names anyway. Also code such as -- if (val val3)\n\t\t\t\t will falsly be recognized as an xml tag. The solution is to put a\n\t\t\t\t space on either side of the comparison operator' 655 | 'end': '(>(<))/(?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]*[_a-zA-Z0-9])(>)' 656 | 'endCaptures': 657 | '1': 658 | 'name': 'punctuation.definition.tag.xml' 659 | '2': 660 | 'name': 'meta.scope.between-tag-pair.xml' 661 | '3': 662 | 'name': 'entity.name.tag.namespace.xml' 663 | '4': 664 | 'name': 'entity.name.tag.xml' 665 | '5': 666 | 'name': 'punctuation.separator.namespace.xml' 667 | '6': 668 | 'name': 'entity.name.tag.localname.xml' 669 | '7': 670 | 'name': 'punctuation.definition.tag.xml' 671 | 'name': 'meta.tag.no-content.xml' 672 | 'patterns': [ 673 | { 674 | 'include': '#xml-embedded-content' 675 | } 676 | ] 677 | } 678 | { 679 | 'begin': '(]*?>)' 680 | 'captures': 681 | '1': 682 | 'name': 'punctuation.definition.tag.xml' 683 | '2': 684 | 'name': 'entity.name.tag.namespace.xml' 685 | '3': 686 | 'name': 'entity.name.tag.xml' 687 | '4': 688 | 'name': 'punctuation.separator.namespace.xml' 689 | '5': 690 | 'name': 'entity.name.tag.localname.xml' 691 | 'end': '(/?>)' 692 | 'name': 'meta.tag.xml' 693 | 'patterns': [ 694 | { 695 | 'include': '#xml-embedded-content' 696 | } 697 | ] 698 | } 699 | { 700 | 'include': '#xml-entity' 701 | } 702 | ] 703 | 'xml-singlequotedString': 704 | 'begin': '\'' 705 | 'beginCaptures': 706 | '0': 707 | 'name': 'punctuation.definition.string.begin.xml' 708 | 'end': '\'' 709 | 'endCaptures': 710 | '0': 711 | 'name': 'punctuation.definition.string.end.xml' 712 | 'name': 'string.quoted.single.xml' 713 | 'patterns': [ 714 | { 715 | 'include': '#xml-entity' 716 | } 717 | ] 718 | 'scopeName': 'source.scala' 719 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "language-scala", 3 | "version": "1.1.10", 4 | "description": "Scala language support in Atom", 5 | "repository": "https://github.com/jroesch/language-scala", 6 | "license": "MIT", 7 | "engines": { 8 | "atom": ">0.50.0" 9 | }, 10 | "dependencies": {} 11 | } 12 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - "." 3 | -------------------------------------------------------------------------------- /settings/language-scala.cson: -------------------------------------------------------------------------------- 1 | '.source.scala': 2 | 'editor': 3 | 'increaseIndentPattern': '(^.*(\\{[^}]*|\\([^)]*)$|^.*\\=\\s*$)' 4 | 'decreaseIndentPattern': '^\\s*(\\}|\\))' 5 | 'commentStart': '// ' 6 | '.keyword.other.documentation.scaladoc.scala': 7 | 'editor': 8 | 'completions': [ 9 | 'author' 10 | 'version' 11 | 'param' 12 | 'return' 13 | 'exception' 14 | 'see' 15 | 'since' 16 | 'serial' 17 | 'deprecated' 18 | 'link' 19 | ] 20 | -------------------------------------------------------------------------------- /snippets/language-scala.cson: -------------------------------------------------------------------------------- 1 | '.source.scala': 2 | 'case class scaffolding': 3 | 'prefix': 'ccc' 4 | 'body': 'class ${1:Class}(${2/(\\S+\\s*:)/val $1/g}) {\n override def hashCode = 0 ${2/(\\S+)\\s*:[^,]+(,?)/+ $1.##/g}\n override def equals(other: Any) = $1.unapply(this) == $1.unapply(other)\n override def canEqual(other: Any) = other.isInstanceOf[$1]\n}\n\nobject $1 {\n def apply(${2:arguments}): $1 = new $1(${2/(\\S+)\\s*:[^,]+/$1/g})\n def unapply(other: Any) = other match {\n case x: $1 => import x._ ; Some(${2/(\\S+)\\s*:[^,]+/$1/g})\n case _ => None\n }\n}\n' 5 | 'case class': 6 | 'prefix': 'case class' 7 | 'body': 'case class $1${2:($3)} ${4:extends ${5:Any} }${6:{\n $7\n\\}}$0' 8 | 'case': 9 | 'prefix': 'case' 10 | 'body': 'case ${1:_} => ${0}' 11 | 'class': 12 | 'prefix': 'class' 13 | 'body': 'class $1${2:($3)} ${4:extends ${5:Any} }{\n\t$0\n}' 14 | 'enumeration': 15 | 'prefix': 'enumeration' 16 | 'body': 'object ${1:MyEnumeration} extends Enumeration {\n type $1 = Value\n val ${2:${3:MyEnumeration1}, ${4:MyEnumeration2}} = Value\n}\n\n${5:import $1._}\n${0}' 17 | 'for - Block': 18 | 'prefix': 'for' 19 | 'body': 'for ($1 <- ${2:${3:0} to ${4:10}}) {\n\t$0\n}' 20 | 'for - Yield': 21 | 'prefix': 'for' 22 | 'body': 'for {\n $1 <- ${2:${3:0} to ${4:10}}\n} yield $0' 23 | 'if': 24 | 'prefix': 'if' 25 | 'body': 'if ($1) {\n\t$2\n}\n' 26 | 'import mutable/immutable': 27 | 'prefix': 'impc' 28 | 'body': 'import scala.collection.{ mutable, immutable, generic }' 29 | 'lambda': 30 | 'prefix': 'lam' 31 | 'body': '($1) => ${2:{${3:}\\}}' 32 | 'left arrow': 33 | 'prefix': '<-' 34 | 'body': '${1:"${2}"} <- ${3:"${4}"}' 35 | 'main': 36 | 'prefix': 'main' 37 | 'body': 'def main(args: Array[String]): Unit = {\n $1\n}\n' 38 | 'match': 39 | 'prefix': 'match' 40 | 'body': 'match {\n\tcase ${1:_} => $0\n}\n' 41 | 'method': 42 | 'prefix': 'def' 43 | 'body': 'def ${1:method}${2:(${4:arg}: ${5:Type})} = {\n\t${0}\n}' 44 | 'object with main method': 45 | 'prefix': 'omain' 46 | 'body': 'object $1 {\n def main(args: Array[String]): Unit = {\n $2\n }\n}\n' 47 | 'object': 48 | 'prefix': 'object' 49 | 'body': 'object $1 ${2:extends ${3:Any} }{\n\t$0\n}' 50 | 'println': 51 | 'prefix': 'pl' 52 | 'body': 'println($0)' 53 | 'right arrow': 54 | 'prefix': '->' 55 | 'body': '${1:"${2}"} -> ${3:"${4}"}' 56 | 'script header': 57 | 'prefix': 'script' 58 | 'body': '#!/bin/sh\n exec scala "\\$0" "\\$@"\n!#\n\n$1' 59 | 'shortcut - case class': 60 | 'prefix': 'cc' 61 | 'body': 'case class' 62 | 'shortcut - class': 63 | 'prefix': 'c' 64 | 'body': 'class' 65 | 'shortcut - enumeration': 66 | 'prefix': 'enum' 67 | 'body': 'enumeration' 68 | 'shortcut - match': 69 | 'prefix': 'm' 70 | 'body': 'match' 71 | 'shortcut - object': 72 | 'prefix': 'obj' 73 | 'body': 'object' 74 | 'shortcut - trait': 75 | 'prefix': 't' 76 | 'body': 'trait' 77 | 'toString': 78 | 'prefix': 'tostr' 79 | 'body': 'override def toString(): String = $0 \n' 80 | 'trait': 81 | 'prefix': 'trait' 82 | 'body': 'trait $1 {\n\t$0\n}' 83 | 'try/catch': 84 | 'prefix': 'try' 85 | 'body': 'try { \n ${1:// ...}\n} catch {\n case e: Exception => $0\n}' 86 | 'with': 87 | 'prefix': 'with' 88 | 'body': 'with ${1:Any}' 89 | 'scaladoc': 90 | 'prefix': '/**' 91 | 'body': '/**\n * $0\n */' 92 | --------------------------------------------------------------------------------