mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Merge pull request #3850 from Microsoft/textClassification
Classify Identifiers as 'Identifier', not 'Text'.
This commit is contained in:
commit
bb53c38786
@ -6575,7 +6575,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
return ClassificationType.text;
|
||||
return ClassificationType.identifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,8 +22,8 @@ var c = classification;
|
||||
verify.syntacticClassificationsAre(
|
||||
c.comment("// comment"),
|
||||
c.keyword("module"), c.moduleName("M"), c.punctuation("{"),
|
||||
c.keyword("var"), c.text("v"), c.operator("="), c.numericLiteral("0"), c.operator("+"), c.numericLiteral("1"), c.punctuation(";"),
|
||||
c.keyword("var"), c.text("s"), c.operator("="), c.stringLiteral('"string"'), c.punctuation(";"),
|
||||
c.keyword("var"), c.identifier("v"), c.operator("="), c.numericLiteral("0"), c.operator("+"), c.numericLiteral("1"), c.punctuation(";"),
|
||||
c.keyword("var"), c.identifier("s"), c.operator("="), c.stringLiteral('"string"'), c.punctuation(";"),
|
||||
c.keyword("class"), c.className("C"), c.punctuation("<"), c.typeParameterName("T"), c.punctuation(">"), c.punctuation("{"),
|
||||
c.punctuation("}"),
|
||||
c.keyword("enum"), c.enumName("E"), c.punctuation("{"),
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
let c = classification
|
||||
verify.syntacticClassificationsAre(
|
||||
c.keyword("class"), c.className("A"), c.punctuation("{"),
|
||||
c.text("a"), c.punctuation(":"),
|
||||
c.identifier("a"), c.punctuation(":"),
|
||||
c.punctuation("}"),
|
||||
c.text("c"), c.operator("=")
|
||||
c.identifier("c"), c.operator("=")
|
||||
);
|
||||
@ -22,8 +22,8 @@ var c = classification;
|
||||
verify.syntacticClassificationsAre(
|
||||
c.comment("// comment"),
|
||||
c.keyword("module"), c.moduleName("M"), c.punctuation("{"),
|
||||
c.keyword("var"), c.text("v"), c.operator("="), c.numericLiteral("0"), c.operator("+"), c.numericLiteral("1"), c.punctuation(";"),
|
||||
c.keyword("var"), c.text("s"), c.operator("="), c.stringLiteral('"string"'), c.punctuation(";"),
|
||||
c.keyword("var"), c.identifier("v"), c.operator("="), c.numericLiteral("0"), c.operator("+"), c.numericLiteral("1"), c.punctuation(";"),
|
||||
c.keyword("var"), c.identifier("s"), c.operator("="), c.stringLiteral('"string"'), c.punctuation(";"),
|
||||
c.keyword("class"), c.className("C"), c.punctuation("<"), c.typeParameterName("T"), c.punctuation(">"), c.punctuation("{"),
|
||||
c.punctuation("}"),
|
||||
c.keyword("enum"), c.enumName("E"), c.punctuation("{"),
|
||||
|
||||
@ -12,8 +12,8 @@ var c = classification;
|
||||
verify.syntacticClassificationsAre(
|
||||
c.keyword("class"), c.className("C"), c.punctuation("{"),
|
||||
c.comment("<<<<<<< HEAD"),
|
||||
c.text("v"), c.operator("="), c.numericLiteral("1"), c.punctuation(";"),
|
||||
c.identifier("v"), c.operator("="), c.numericLiteral("1"), c.punctuation(";"),
|
||||
c.comment("======="),
|
||||
c.text("v"), c.punctuation("="), c.numericLiteral("2"), c.punctuation(";"),
|
||||
c.identifier("v"), c.punctuation("="), c.numericLiteral("2"), c.punctuation(";"),
|
||||
c.comment(">>>>>>> Branch - a"),
|
||||
c.punctuation("}"));
|
||||
@ -11,5 +11,5 @@ verify.syntacticClassificationsAre(
|
||||
c.comment("<<<<<<< HEAD"),
|
||||
c.keyword("class"), c.className("C"), c.punctuation("{"), c.punctuation("}"),
|
||||
c.comment("======="),
|
||||
c.keyword("class"), c.text("D"), c.punctuation("{"), c.punctuation("}"),
|
||||
c.keyword("class"), c.identifier("D"), c.punctuation("{"), c.punctuation("}"),
|
||||
c.comment(">>>>>>> Branch - a"));
|
||||
@ -13,5 +13,5 @@ verify.syntacticClassificationsAre(
|
||||
c.punctuation("}"),
|
||||
c.comment(" */"),
|
||||
c.keyword("var"),
|
||||
c.text("v"),
|
||||
c.identifier("v"),
|
||||
c.punctuation(";"));
|
||||
|
||||
@ -15,12 +15,12 @@ verify.syntacticClassificationsAre(
|
||||
c.punctuation("{"),
|
||||
c.keyword("function"),
|
||||
c.punctuation("("),
|
||||
c.text("x"),
|
||||
c.identifier("x"),
|
||||
c.punctuation(")"),
|
||||
c.punctuation(":"),
|
||||
c.keyword("string"),
|
||||
c.punctuation("}"),
|
||||
c.comment(" */"),
|
||||
c.keyword("var"),
|
||||
c.text("v"),
|
||||
c.identifier("v"),
|
||||
c.punctuation(";"));
|
||||
|
||||
@ -15,5 +15,5 @@ verify.syntacticClassificationsAre(
|
||||
c.keyword("number"),
|
||||
c.comment(" /* } */"),
|
||||
c.keyword("var"),
|
||||
c.text("v"),
|
||||
c.identifier("v"),
|
||||
c.punctuation(";"));
|
||||
|
||||
@ -7,9 +7,9 @@ verify.syntacticClassificationsAre(
|
||||
c.keyword("for"),
|
||||
c.punctuation("("),
|
||||
c.keyword("var"),
|
||||
c.text("of"),
|
||||
c.identifier("of"),
|
||||
c.keyword("of"),
|
||||
c.text("of"),
|
||||
c.identifier("of"),
|
||||
c.punctuation(")"),
|
||||
c.punctuation("{"),
|
||||
c.punctuation("}")
|
||||
|
||||
@ -7,9 +7,9 @@ verify.syntacticClassificationsAre(
|
||||
c.keyword("for"),
|
||||
c.punctuation("("),
|
||||
c.keyword("var"),
|
||||
c.text("of"),
|
||||
c.identifier("of"),
|
||||
c.keyword("in"),
|
||||
c.text("of"),
|
||||
c.identifier("of"),
|
||||
c.punctuation(")"),
|
||||
c.punctuation("{"),
|
||||
c.punctuation("}")
|
||||
|
||||
@ -7,11 +7,11 @@ verify.syntacticClassificationsAre(
|
||||
c.keyword("for"),
|
||||
c.punctuation("("),
|
||||
c.keyword("var"),
|
||||
c.text("of"),
|
||||
c.identifier("of"),
|
||||
c.punctuation(";"),
|
||||
c.text("of"),
|
||||
c.identifier("of"),
|
||||
c.punctuation(";"),
|
||||
c.text("of"),
|
||||
c.identifier("of"),
|
||||
c.punctuation(")"),
|
||||
c.punctuation("{"),
|
||||
c.punctuation("}")
|
||||
|
||||
@ -19,7 +19,7 @@ var firstCommentText =
|
||||
var c = classification;
|
||||
verify.syntacticClassificationsAre(
|
||||
c.comment(firstCommentText),
|
||||
c.keyword("function"), c.text("myFunction"), c.punctuation("("), c.comment("/* x */"), c.parameterName("x"), c.punctuation(":"), c.keyword("any"), c.punctuation(")"), c.punctuation("{"),
|
||||
c.keyword("var"), c.text("y"), c.operator("="), c.text("x"), c.operator("?"), c.text("x"), c.operator("++"), c.operator(":"), c.operator("++"), c.text("x"), c.punctuation(";"),
|
||||
c.keyword("function"), c.identifier("myFunction"), c.punctuation("("), c.comment("/* x */"), c.parameterName("x"), c.punctuation(":"), c.keyword("any"), c.punctuation(")"), c.punctuation("{"),
|
||||
c.keyword("var"), c.identifier("y"), c.operator("="), c.identifier("x"), c.operator("?"), c.identifier("x"), c.operator("++"), c.operator(":"), c.operator("++"), c.identifier("x"), c.punctuation(";"),
|
||||
c.punctuation("}"),
|
||||
c.comment("// end of file"));
|
||||
@ -13,13 +13,13 @@
|
||||
|
||||
var c = classification;
|
||||
verify.syntacticClassificationsAre(
|
||||
c.keyword("var"), c.text("v"), c.operator("="), c.numericLiteral("10e0"), c.punctuation(";"),
|
||||
c.keyword("var"), c.text("x"), c.operator("="), c.punctuation("{"),
|
||||
c.text("p1"), c.punctuation(":"), c.numericLiteral("1"), c.punctuation(","),
|
||||
c.text("p2"), c.punctuation(":"), c.numericLiteral("2"), c.punctuation(","),
|
||||
c.text("any"), c.punctuation(":"), c.numericLiteral("3"), c.punctuation(","),
|
||||
c.text("function"), c.punctuation(":"), c.numericLiteral("4"), c.punctuation(","),
|
||||
c.text("var"), c.punctuation(":"), c.numericLiteral("5"), c.punctuation(","),
|
||||
c.text("void"), c.punctuation(":"), c.keyword("void"), c.numericLiteral("0"), c.punctuation(","),
|
||||
c.text("v"), c.punctuation(":"), c.text("v"), c.operator("+="), c.text("v"), c.punctuation(","),
|
||||
c.keyword("var"), c.identifier("v"), c.operator("="), c.numericLiteral("10e0"), c.punctuation(";"),
|
||||
c.keyword("var"), c.identifier("x"), c.operator("="), c.punctuation("{"),
|
||||
c.identifier("p1"), c.punctuation(":"), c.numericLiteral("1"), c.punctuation(","),
|
||||
c.identifier("p2"), c.punctuation(":"), c.numericLiteral("2"), c.punctuation(","),
|
||||
c.identifier("any"), c.punctuation(":"), c.numericLiteral("3"), c.punctuation(","),
|
||||
c.identifier("function"), c.punctuation(":"), c.numericLiteral("4"), c.punctuation(","),
|
||||
c.identifier("var"), c.punctuation(":"), c.numericLiteral("5"), c.punctuation(","),
|
||||
c.identifier("void"), c.punctuation(":"), c.keyword("void"), c.numericLiteral("0"), c.punctuation(","),
|
||||
c.identifier("v"), c.punctuation(":"), c.identifier("v"), c.operator("+="), c.identifier("v"), c.punctuation(","),
|
||||
c.punctuation("}"), c.punctuation(";"));
|
||||
@ -8,8 +8,8 @@
|
||||
|
||||
var c = classification;
|
||||
verify.syntacticClassificationsAre(
|
||||
c.keyword("var"), c.text("v"), c.operator("="), c.numericLiteral("10e0"), c.punctuation(";"),
|
||||
c.keyword("var"), c.text("x"), c.operator("="), c.punctuation("{"),
|
||||
c.text("p1"), c.punctuation(":"), c.stringLiteral("`hello world`"), c.punctuation(","),
|
||||
c.text("p2"), c.punctuation(":"), c.stringLiteral("`goodbye ${"), c.numericLiteral("0"), c.stringLiteral("} cruel ${"), c.numericLiteral("0"), c.stringLiteral("} world`"), c.punctuation(","),
|
||||
c.keyword("var"), c.identifier("v"), c.operator("="), c.numericLiteral("10e0"), c.punctuation(";"),
|
||||
c.keyword("var"), c.identifier("x"), c.operator("="), c.punctuation("{"),
|
||||
c.identifier("p1"), c.punctuation(":"), c.stringLiteral("`hello world`"), c.punctuation(","),
|
||||
c.identifier("p2"), c.punctuation(":"), c.stringLiteral("`goodbye ${"), c.numericLiteral("0"), c.stringLiteral("} cruel ${"), c.numericLiteral("0"), c.stringLiteral("} world`"), c.punctuation(","),
|
||||
c.punctuation("}"), c.punctuation(";"));
|
||||
@ -6,6 +6,6 @@
|
||||
|
||||
var c = classification;
|
||||
verify.syntacticClassificationsAre(
|
||||
c.keyword("var"), c.text("tiredOfCanonicalExamples"), c.operator("="),
|
||||
c.keyword("var"), c.identifier("tiredOfCanonicalExamples"), c.operator("="),
|
||||
c.stringLiteral("`goodbye \"${"), c.stringLiteral("`hello world`"),
|
||||
c.stringLiteral("}\" \nand ${"), c.stringLiteral("`good${"), c.stringLiteral("\" \""), c.stringLiteral("}riddance`"), c.stringLiteral("}`"), c.punctuation(";"));
|
||||
Loading…
x
Reference in New Issue
Block a user