microsoft / typescript-tmlanguage Goto Github PK
View Code? Open in Web Editor NEWTextMate grammar files for TypeScript for VS Code, Sublime Text, and Atom.
License: MIT License
TextMate grammar files for TypeScript for VS Code, Sublime Text, and Atom.
License: MIT License
From @santiagohdzb on January 11, 2016 18:25
I'm writing TypeScript code and everything is fine. But when I don't write semicolons this happens:
IntelliSense works fine, no errors are shown (as expected) but i get this weird syntax highlighting
VSCode: 0.10.6
Platform: Windows 8.1
Copied from original issue: microsoft/vscode#1933
Tokenize this:
return this.travelWorld((cell: Cell) => {
cell.live = Math.random() < this.initialLifeProbability;
return cell;
});
Note that cell: Cell
is a single token (scope block body decl declaration meta method object ts
).
It would be great if it can follow the tokenization for functions
class A {
}
interface Inter {
}
class Cl extends A implements Inter {
}
'A' and 'Inter' have same color as that of the keyword in the line 'class Cl extends A implements Inter'
From @niieani on November 25, 2015 16:44
This content doesn't get parsed correctly for coloring:
export declare const localhostAliases: {
'localhost': boolean;
'127.0.0.1': boolean;
'::1': boolean;
};
Copied from original issue: microsoft/vscode#635
ES6 has a shorthand syntax for defining methods on objects similar to that of a class.
The method declaration in
let x = {
hello() {
let hello = "world";
}
};
should have the same highlighting as
class X {
hello() {
let hello = "world";
}
}
In the current TypeScript Sublime Text plugin, the method name in the first code sample is not highlighted:
(as a side note, GitHub has the same highlighting issue at present; do they use this repository?)
From @Bigous on December 4, 2015 12:48
When you are writing in TypeScript, arrow function does not get the parameter names colored. Using anonymous functions you get it colored.
Copied from original issue: microsoft/vscode#1013
Example:
Also happens if I use default color scheme. Screenshots are from Sublime Text 2.0.2.
(edit: Same problem occurs in Visual Studio Code)
Ported from microsoft/TypeScript-Sublime-Plugin#380
Numbers such as to 10e3 or 1e99 are not highlighted as numbers in Typescript.
Ported from microsoft/TypeScript-Sublime-Plugin#390
From @igabesz on November 26, 2015 11:26
TypeScript highlighter interprets if
calls within a for
loop as function definitions if the if
has middle parameter and brackets. The interpretation starts failing in the for
loop for the last parameter.
Not the consequence of installed extensions.
Highlighting fails for other color themes as well, not only Monokai.
// OK
for (var i=0;; i++) {
if (i===0) {}
}
// Partially wrong, see for loop 3rd parameter
for (let i=0; i<5; i++)
if (i===0) {}
// Wrong
for (var i=0; i<5; i++) {
if (i===0) {}
}
// Wrong
for (let i=0; i<5; i++) {
if (i===0) {}
}
// Wrong
for (; i<5;) {
if (i===0) {}
}
Copied from original issue: microsoft/vscode#704
From @bpasero on January 18, 2016 6:23
Copied from original issue: microsoft/vscode#2076
We need to transition the Sublime repo into depending on this repository. In theory, this is as simple as adding a submodule or subtree (though it sounds like what we want is just a subtree).
One problem is that the Sublime repository currently depends on this repository's top-level files existing in its own top level. Two solutions are:
I personally am leaning towards option 1.
An open question is whether or not the testing plugin should be merged into this repository. I am leaning towards us doing so. There is no reason our testing infrastructure needs to be private and separate from this repo. Merging the two will reduce friction for contributors and encourage users to write tests.
From @tinganho on January 14, 2016 8:22
class A {
public props = {} as {};
public a: string;
}
The second public keyword is not being highlighted in blue.
Copied from original issue: microsoft/vscode#2002
Try the following example in VS code (0.10.6) in the dark theme:
module Body {
export class Cell {
public parent: Cell;
constructor(parent: Cell) {
this.parent = parent;
if (typeof parent === 'object' || parent instanceof Error) {
}
}
Note that instanceof
and typeof
are rendered white instead of blue as other keywords.
The TS grammar uses 'keyword.operator' for operator symbols like '=', '+', '!=', but also for JS keywords as switch, instanceof, import, delete, export, import, from, in, new, void, as, of.
We want to colorize the keywords, but not the symbols.
My suggestion is to use 'keyword.operator' only for symbols
From @fabiogusmao on January 22, 2016 16:11
Just a minor issue but I noticed that if you put a comment line in the middle of a function declaration the comment line is not showing in gray.
Copied from original issue: microsoft/vscode#2185
From @takumif on December 4, 2015 22:26
When a keyword such as class
appears as a key in an object, syntax highlighting for method declaration no longer works for the rest of the file.
class A {
private getSomeObj() {
var obj = {
class: 'Class Name',
id: 1
};
return obj;
}
private someOtherMethod() {
return 0;
}
}
Copied from original issue: microsoft/vscode#1030
Ported from microsoft/TypeScript-Sublime-Plugin#377
Hi,
I want to use decorators, but they mess up the syntax coloring.
Could support for decorators be added? Even if it is only to avoid messing up the rest of the code?
Currently, the decorators look odd, but when a parameter decorator is combined with a pair: method(@AdapterParam() {req, res}: AdapterData)
, the syntax is lost.
I wish I could send a pull request, but I can't seem to understand how the tmLanguage system works.
A patch for me locally would also be awesome (in case you don't want support for experimental features).
Thanks a lot!
Ported from microsoft/TypeScript-Sublime-Plugin#285
Related to microsoft/TypeScript-Sublime-Plugin#265.
When using multi line string in typescript, the code colouring is broken.
let name = '\
Dirk \
Baeumer \
'
Ported from microsoft/TypeScript-Sublime-Plugin#392
From @ElfenLiedGH on December 22, 2015 7:14
1.Связные_серверы - don't work break "extends"
2.Связныесерверы - ok
3.Базовая_выборка break this. super... to the second ""
Copied from original issue: microsoft/vscode#1565
From @KevinSCreative on December 30, 2015 18:13
After the first line, multi-line strings in JavaScript don't get string color. In the following example, only "Hello World" has the string color, and the obj variable declaration is all one color. In the default theme, 'var' is supposed to be blue. I would also expect the rest of the string to be orange in the default theme, not just the first line.
I am running VSC 0.10.6 and I have no extensions installed.
var test = 'Hello World!\
<div>\
<p>Testing</p>\
</div>\
';
var obj = $(test);
Copied from original issue: microsoft/vscode#1716
In this example, x, y and constructor will not be properly colored. As you add in semi-colons, their highlighting is fixed.
Happens in Atom, Visual Studio Code.
Original bug: TypeStrong/atom-typescript#820
From @Franziskus1988 on December 23, 2015 10:58
interface TestInterface {
testvar: string <- "string" colored;
testfunc(): string <- "string" not colored;
}
Copied from original issue: microsoft/vscode#1612
Extracted from microsoft/vscode#1470 reported by @MacKentoch
Got same issues with javascript ES6.
As examples
import
(was red before) is now just greyconstructor
is now greyOccurs in OSX El capitan
and windows 10
.
Jsx seems not that much impacted (but still improvements to be done).
Ported from microsoft/TypeScript-Sublime-Plugin#374
From @felixfbecker on January 3, 2016 12:18
public
and private
should be blue
Copied from original issue: microsoft/vscode#1753
Highlight doesn't work for types in this case:
export default <ApplicationConfig> {
// config object
}
Async highlight is not working for decorated methods (Atom, atom-typescript 8.1)
@Action('/promise')
public async asyncResponse(): Promise<Object> {
return {
promiseResult: 'promise is ok'
}
}
also, class
keyword now looks like type
in this example:
export class IndexController extends AppController {
...
original issue: TypeStrong/atom-typescript#819
Ported from microsoft/TypeScript-Sublime-Plugin#354
Using the following source (valid in at least TypeScript 1.6):
enum Hello {
A,
B
}
class World {
normal() {
let x = 5;
console.log("hello");
}
[Hello.A]() {
let x = 5;
console.log("hello");
}
}
This causes very strange highlighting in the body of the method declaration:
From @isidorn on December 14, 2015 15:33
Colons should not be colored blue, they should remain black.
Copied from original issue: microsoft/vscode#1291
Currently the test code is checking none of the test cases except the last one, through a classic closure mistake in tests/test.ts:
describe("Compare generated with baselines", () => {
for (var file of fs.readdirSync('generated')) {
var generatedText = fs.readFileSync('generated/' + file, 'utf8');
var baselinesText = fs.readFileSync('baselines/' + file, 'utf8');
describe('Comparing ' + file, () => {
it('should be the same', () => {
chai.expect(compareText(generatedText, baselinesText)).to.true;
})
})
}
})
Only the last generated values of generatedText
and baselinesText
will be checked against other each time. In actual fact these tests are failing:
It's is easy enough to fix (the test code, not the failing tests) and I'm happy to submit a PR too but I wanted to add some other issues I came across while trying to make and test some changes to the syntax files:
tsd install
. This should be automated (probably as part of npm install
), or documented./tests/typings
folder should be added to .gitignore
assertion-error.d.ts
doesn't seem to be used and the chai
module is barely used. Not if there were other things planned for these.From @felixfbecker on January 3, 2016 14:38
export
should be blue
Copied from original issue: microsoft/vscode#1754
Try the following example in VS code (0.10.6) in the dark theme:
module Conway {
export interface Foo {
}
export class Bar {
}
export class Cell extends Bar implements Foo {
}
}
Note that implements
is colored like the type. It gets the same scope as the type name
(block declaration heritage meta object parent storage type ts
)
The TypeScript textmate grammar does not emit a specific token for object keys.
Other grammars (e.g. JavaScript grammar from https://github.com/textmate/javascript.tmbundle) use token attribute-name entity name js
as scope for keys.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.