Skip to content

Fix nested comments ... #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
25 changes: 10 additions & 15 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,6 @@ export const scalaTmLanguage: TmLanguage = {
}
]
},
'block-comments': {
end: '\\*/',
begin: '/\\*',
patterns: [
{
include: '#block-comments'
},
{
match: '(?x)(?! /\\*)(?! \\*/)'
}
],
name: 'comment.block.scala'
},
'script-header': {
match: '^#!(.*)$',
captures: {
Expand Down Expand Up @@ -697,7 +684,7 @@ export const scalaTmLanguage: TmLanguage = {
}
},
{
match: '@(return|see|note|example|usecase|author|version|since|todo|deprecated|migration|define|inheritdoc)\\b',
match: '@(return|see|note|example|constructor|usecase|author|version|since|todo|deprecated|migration|define|inheritdoc)\\b',
name: 'keyword.other.documentation.scaladoc.scala'
},
{
Expand All @@ -707,12 +694,15 @@ export const scalaTmLanguage: TmLanguage = {
name: 'punctuation.definition.documentation.link.scala'
},
'2': {
name: 'entity.other.documentation.link.scala'
name: 'string.other.link.title.markdown'
},
'3': {
name: 'punctuation.definition.documentation.link.scala'
}
}
},
{
"include": "#comments"
}
],
endCaptures: {
Expand All @@ -730,6 +720,11 @@ export const scalaTmLanguage: TmLanguage = {
name: 'punctuation.definition.comment.scala'
}
},
patterns: [
{
"include": "#comments"
}
],
name: 'comment.block.scala'
},
{
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/Scala.tmLanguage.json

Large diffs are not rendered by default.

141 changes: 141 additions & 0 deletions tests/snap/comments.test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/// SYNTAX TEST "source.scala"
#!/usr/bin/env scala

// single line comments

/* /**/ /** */ /* comments within comments */ */

/** /* */ /** **/ **/


/************************
*
* [[scala.Option]]
* @return smth
***********************/

case class C(val x: Int) {
def f(p:Double) : String = {

}
}

/** Provides classes for dealing with complex numbers. Also provides
* implicits for converting to and from `Int`.
*
* ==Overview==
* The main class to use is [[my.package.complex.Complex]], as so
* {{{
* scala> val complex = Complex(4,3)
* complex: my.package.complex.Complex = 4 + 3i
* }}}
*
* If you include [[my.package.complex.ComplexConversions]], you can
* convert numbers more directly
* {{{
* scala> import my.package.complex.ComplexConversions._
* scala> val complex = 4 + 3.i
* complex: my.package.complex.Complex = 4 + 3i
* }}}
*/
package complex {}

/** A person who uses our application.
*
* @constructor create a new person with a name and age.
* @tparam T useless param
* @param name the person's name
* @param age the person's age in years
* @throws java.lang.Exception
*
* @see reference other sources of information like external document links or related entities in the documentation.
* @note add a note for pre or post conditions, or any other notable restrictions or expectations.
* @example for providing example code or related example documentation.
* @usecase def apply(name: String, age: Int) : Unit
*
* @groupname group name
* @groupprio group 2
* @groupdesc group desc
* @group group
* @contentDiagram
*
*
* @author provide author information for the following entity
* @version the version of the system or API that this entity is a part of.
* @since like @version but defines the system or API that this entity was first defined in.
* @todo for documenting unimplemented features or unimplemented aspects of an entity.
* @deprecated marks the entity as deprecated, providing both the replacement implementation that should be used and the version/date at which this entity was deprecated.
* @migration like deprecated but provides advanced warning of planned changes ahead of deprecation. Same fields as @deprecated.
* @inheritdoc take comments from a superclass as defaults if comments are not provided locally.
* @documentable Expand a type alias and abstract type into a full template page. - TODO: Test the “abstract type” claim - no examples of this in the Scala code base
*
* @define <name> <definition>
*
* @shortDescription ???
* @hideImplicitConversion ???
*
*/
class Person[T](name: String, age: Int) {
}

/** Factory for [[mypackage.Person]] instances. */
object Person {
/** Creates a person with a given name and age.
*
* @param name their name
* @param age the age of the person to create
*/
def apply(name: String, age: Int) = {}

/** Creates a person with a given name and birthdate
*
* @param name their name
* @param birthDate the person's birthdate
* @return a new Person instance with the age determined by the
* birthdate and current date.
*/
def apply(name: String, birthDate: java.util.Date) = {}
}

/** Implicit conversions and helpers for [[mypackage.Complex]] instances.
*
* {{{
* import ComplexImplicits._
* val c: Complex = 4 + 3.i
* }}}
*/
object ComplexImplicits {}

/**
* =Heading=, ==Sub-Heading==
*
* `monospace`
* ''italic text''
* '''bold text'''
* __underline__
* ^superscript^
* ,,subscript,,
* [[entity link]], e.g. [[scala.collection.Seq]]
* [[http://external.link External Link]],
* e.g. [[http://scala-lang.org Scala Language Site]]
*
*/
object Markup {
/** Here is an unordered list:
*
* - First item
* - Second item
* - Sub-item to the second
* - Another sub-item
* - Third item
*
* Here is an ordered list:
*
* 1. First numbered item
* 1. Second numbered item
* i. Sub-item to the second
* i. Another sub-item
* 1. Third item
*/
def lists = ()
}
Loading