Commit graph

310 commits

Author SHA1 Message Date
Mohamed Hegazy
5aca35e35f Move unit tests to use the new adaptors 2015-02-03 17:28:33 -08:00
Cyrus Najmabadi
95702a89a7 Fix spelling of 'Filename' to be 'FileName'. 2015-02-03 16:08:46 -08:00
Vladimir Matveev
288e38fa36 merge with master 2015-02-03 11:26:39 -08:00
Mohamed Hegazy
d6bd9f74d2 Merge branch 'master' into LSAPICleanup 2015-02-02 18:49:13 -08:00
Cyrus Najmabadi
5343336763 Baseline updates now that we no longer have early errors. 2015-02-02 15:15:54 -08:00
Mohamed Hegazy
0257acebd3 Respond to code review comments 2015-01-26 16:45:34 -08:00
Mohamed Hegazy
1b1a45be6b update unit test contents 2015-01-20 11:03:51 -08:00
Mohamed Hegazy
66f8257fc8 Remove isOpen from souceFile and LanugageServiceHost interfaces 2015-01-16 21:23:51 -08:00
Vladimir Matveev
c40977c5fb move getSyntacticDiagnostics out of SourceFile 2015-01-16 12:32:37 -08:00
Cyrus Najmabadi
48bef4698b Provide better error recovery when we encounter merge markers in the source.
Previously we would just treat each merge marker as trivia and then continue
scanning and parsing like normal.  This worked well in some scenarios, but
fell down in others like:

```
class C {
    public foo() {
<<<<<<< HEAD
        this.bar();
    }
=======
        this.baz();
    }
>>>>>>> Branch

    public bar() { }
}
```

The problem stems from the previous approach trying to incorporate both branches of the merge into
the final tree.  In a case like this, that approach breaks down entirely.  The the parser ends up
seeing the close curly in both included sections, and it considers the class finished.  Then, it
starts erroring when it encounters "public bar()".

The fix is to only incorporate one of these sections into the tree.  Specifically, we only include
the first section.  The second sectoin is treated like trivia and does not affect the parse at all.
To make the experience more pleasant we do *lexically* classify the second section.  That way it
does not appear as just plain black text in the editor.  Instead, it will have appropriate lexicla
classifications for keywords, literals, comments, operators, punctuation, etc.  However, any syntactic
or semantic feature will not work in the second block due to this being trivia as far as any feature
is concerned.

This experience is still much better than what we had originally (where merge markers would absolutely)
destroy the parse tree.  And it is better than what we checked in last week, which could easily create
a borked tree for many types of merges.

Now, almost all merges should still leave the tree in good shape.  All LS features will work in the
first section, and lexical classification will work in the second.
2014-12-18 19:18:13 -08:00
Cyrus Najmabadi
4545549e07 Disable incremental by default before merging into master. 2014-12-17 12:41:08 -08:00
Cyrus Najmabadi
bd76ebd02b Enable incremental parsing by default.
Provide flag to disable incremental parsing if necessary.
2014-12-14 12:39:11 -08:00
Cyrus Najmabadi
e1e5243335 Merge branch 'typingHighFidelity' into sourceFileUpdate
Conflicts:
	tests/cases/unittests/incrementalParser.ts
2014-12-14 12:06:26 -08:00
Cyrus Najmabadi
f5d622f0c9 Move test helpers into the harness Utils module. 2014-12-14 10:57:34 -08:00
Cyrus Najmabadi
d5c6636854 Parse function and variable declarations uniformly, whether they're at teh top level, or inside a method.
This is necessary for incremental parsing correctness, as the incremental parser
will attempt to reuse these types of nodes in both contexts, and we much ensure
it creates the same trees you would get if you were parsing normally.
2014-12-12 03:52:01 -08:00
Cyrus Najmabadi
8820ca0596 Change the error-bit to be a node-flag and not a parser context flag.
Do not reuse nodes with errors in them.  We need to reparse them to make
sure we produce the right errors the second time around.
2014-12-12 03:25:49 -08:00
Cyrus Najmabadi
60c62e5b6b Don't consume nodes during calls to isListElement. 2014-12-12 03:06:05 -08:00
Cyrus Najmabadi
9c0e4211bc Properly adjust nodes while walking down the tree. 2014-12-12 02:34:53 -08:00
Cyrus Najmabadi
2f833d5f97 Provide a way for tests to try out incremental parsing. 2014-12-12 02:21:45 -08:00
Cyrus Najmabadi
f218ce7684 Merge branch 'master' into sourceFileUpdate
Conflicts:
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/compiler/parser.ts
	tests/baselines/reference/APISample_node_compile.js
	tests/baselines/reference/APISample_node_compile.types
	tests/baselines/reference/APISample_standalone_compile.js
	tests/baselines/reference/APISample_standalone_compile.types
2014-12-12 00:52:07 -08:00
Cyrus Najmabadi
402c57cf7e Adding classification test. 2014-12-11 17:04:21 -08:00
Cyrus Najmabadi
fbeb7dd75e Merge branch 'funcDeclsInBlocks' into sourceFileUpdate
Conflicts:
	src/services/outliningElementsCollector.ts
2014-12-11 15:16:46 -08:00
Cyrus Najmabadi
ba0fd4453d Add additional incremental tests. 2014-12-10 23:04:13 -08:00
Cyrus Najmabadi
ee828dc1da More incremental parser tests. 2014-12-10 19:15:44 -08:00
Cyrus Najmabadi
563b234240 Incremental parser tests should verify the same set of diagnostics are produced. 2014-12-10 19:07:36 -08:00
Cyrus Najmabadi
888b88ee43 Move textSpan and textChangeRange impls to the compiler layer. 2014-12-10 14:36:37 -08:00
Cyrus Najmabadi
c2d4cd5887 Move TextSpan into the compiler layer. 2014-12-10 13:45:08 -08:00
Cyrus Najmabadi
5bd49fec1d Initial entrypoint in SourceFile for the LS to call to peform incremental parsing.
Right now the entrypoint just causes a full parse to happen.  But the LS code is
cleaned up to take advantage of it appropriately.
2014-12-10 11:45:33 -08:00
Cyrus Najmabadi
1170a1c436 Only set parents for parse trees in the LS for the syntactic trees.
we don't need this for the semantic trees because the compiler will set them all during
the binding.
2014-12-10 10:09:40 -08:00
Cyrus Najmabadi
dd2c869d7b Use chai asserts. 2014-12-09 19:49:40 -08:00
Cyrus Najmabadi
aa30ac8a9c Add incremental test. 2014-12-09 19:37:26 -08:00
Cyrus Najmabadi
2a845726ab Add incremental test. 2014-12-09 18:36:32 -08:00
Cyrus Najmabadi
3c35b9097f Add incremental test. 2014-12-09 18:35:23 -08:00
Cyrus Najmabadi
58d36afbec Add incremental test. 2014-12-09 18:32:43 -08:00
Cyrus Najmabadi
3928f743ac Add incremental test. 2014-12-09 18:30:40 -08:00
Cyrus Najmabadi
01ead476cf Add incremental test. 2014-12-09 18:29:18 -08:00
Cyrus Najmabadi
b8bb8e9998 Add incremental test. 2014-12-09 18:27:59 -08:00
Cyrus Najmabadi
467d303c67 Add incremental test. 2014-12-09 18:26:50 -08:00
Cyrus Najmabadi
dad3faecf3 Add incremental test. 2014-12-09 18:25:10 -08:00
Cyrus Najmabadi
c489c4fcfe Add incremental test. 2014-12-09 18:24:16 -08:00
Cyrus Najmabadi
9b53947d51 Add incremental test. 2014-12-09 18:23:25 -08:00
Cyrus Najmabadi
afec0fb9f0 Add incremental test. 2014-12-09 18:17:11 -08:00
Cyrus Najmabadi
197b62e92a Add incremental test. 2014-12-09 18:13:09 -08:00
Cyrus Najmabadi
025dd23c1b Add incremental test. 2014-12-09 18:11:56 -08:00
Cyrus Najmabadi
78c4b92216 Add incremental test. 2014-12-09 18:10:15 -08:00
Cyrus Najmabadi
d6fa98d00b Add incremental test. 2014-12-09 18:07:48 -08:00
Cyrus Najmabadi
ec13fbee96 Add incremental test. 2014-12-09 18:05:45 -08:00
Cyrus Najmabadi
3e70073211 Add incremental test. 2014-12-09 18:03:52 -08:00
Cyrus Najmabadi
18f9acb7fc Add incremental test. 2014-12-09 18:00:08 -08:00
Cyrus Najmabadi
b8942992a0 Add incremental test. 2014-12-09 17:58:23 -08:00
Cyrus Najmabadi
418c0d9d91 Add incremental test. 2014-12-09 17:57:13 -08:00
Cyrus Najmabadi
5b2778c200 Add incremental test. 2014-12-09 17:45:50 -08:00
Cyrus Najmabadi
666363a7de Add incremental test. 2014-12-09 17:42:36 -08:00
Cyrus Najmabadi
e564fa5c9d Add incremental test. 2014-12-09 17:37:17 -08:00
Cyrus Najmabadi
c307d306c0 Add incremental test. 2014-12-09 17:34:26 -08:00
Cyrus Najmabadi
c436ff47a1 Add incremental test. 2014-12-09 17:33:15 -08:00
Cyrus Najmabadi
c7fcbb9f6b Add incremental test. 2014-12-09 17:29:52 -08:00
Cyrus Najmabadi
1cd2fb4333 Add incremental test. 2014-12-09 17:23:14 -08:00
Cyrus Najmabadi
c482a9e0e3 Add incremental test. 2014-12-09 17:22:15 -08:00
Cyrus Najmabadi
6058dbbc2f Add incremental test. 2014-12-09 17:21:30 -08:00
Cyrus Najmabadi
d5e2ab993e Add incremental test. 2014-12-09 17:20:44 -08:00
Cyrus Najmabadi
a1b8a7891b Add incremental test. 2014-12-09 17:19:44 -08:00
Cyrus Najmabadi
82098d1568 Add incremental test. 2014-12-09 17:18:18 -08:00
Cyrus Najmabadi
d549677911 Add incremental test. 2014-12-09 17:15:13 -08:00
Cyrus Najmabadi
fa86c88c47 Add incremental test. 2014-12-09 17:13:33 -08:00
Cyrus Najmabadi
7f605332fc Add incremental test. 2014-12-09 17:12:44 -08:00
Cyrus Najmabadi
22f39c5f99 Add incremental test. 2014-12-09 17:11:32 -08:00
Cyrus Najmabadi
e59ba41d17 Add incremental test. 2014-12-09 17:09:33 -08:00
Cyrus Najmabadi
bb34a20b4d Add incremental test. 2014-12-09 17:07:51 -08:00
Cyrus Najmabadi
e41bed82e4 Add incremental test. 2014-12-09 17:06:44 -08:00
Cyrus Najmabadi
a0a8ee0d4f Add incremental test. 2014-12-09 17:05:14 -08:00
Cyrus Najmabadi
45f87131ab Add incremental test. 2014-12-09 16:59:02 -08:00
Cyrus Najmabadi
de84ddd815 Add incremental test. 2014-12-09 16:57:51 -08:00
Cyrus Najmabadi
778e180e40 Add incremental test. 2014-12-09 16:56:00 -08:00
Cyrus Najmabadi
bcffd5331c Add incremental test. 2014-12-09 16:55:02 -08:00
Cyrus Najmabadi
4de7fa0181 Add incremental test. 2014-12-09 16:54:06 -08:00
Cyrus Najmabadi
d8ff734bfc Add incremental test. 2014-12-09 16:53:18 -08:00
Cyrus Najmabadi
2497d9abdf Add incremental test. 2014-12-09 16:51:55 -08:00
Cyrus Najmabadi
a268cbf2d8 Add incremental test. 2014-12-09 16:50:31 -08:00
Cyrus Najmabadi
9d457701cc Add incremental test. 2014-12-09 16:47:19 -08:00
Cyrus Najmabadi
fa4b68fa6c Initial test harness for incremental parser tests. 2014-12-09 16:39:52 -08:00
Daniel Rosenwasser
cef5062791 Fixed issue where classifier didn't check for backslash-newline. 2014-11-26 16:32:30 -08:00
Vladimir Matveev
ced8785bd3 eliminate usage of TypeScript module from services layer 2014-11-17 17:01:23 -08:00
Yui T
3c6d9c8173 Remove old commit and debugger flag 2014-10-29 14:27:43 -07:00
Yui T
4f6ccab5e9 Move Convert FileReference to the shim 2014-10-28 14:45:32 -07:00
Yui T
acbc28d3e1 Add tests case for invalid syntax in import statement and triple slash reference 2014-10-27 17:09:59 -07:00
Yui T
300c059d1f Remove diagnostic from pre-processing of files 2014-10-27 17:03:06 -07:00
Yui T
7f8b24c6cc Fix getTokenPos for scanning import statement 2014-10-27 10:09:57 -07:00
Yui T
95f6cbe760 Add unittests for preProcessFile 2014-10-24 16:03:59 -07:00
Yui T
54bc1da5d0 Address code review 2014-10-20 14:39:31 -07:00
Yui T
ba77284485 Fix colorization unittest 2014-10-20 13:11:08 -07:00
Yui T
30fe3f7221 Fix runtests for unittests 2014-10-20 13:08:33 -07:00
Cyrus Najmabadi
e751c34fcb Add some heuristics in the lexical classifier to make it play better with the syntactic classifier when classifying expressions involving generics. 2014-10-03 01:54:43 -07:00
Cyrus Najmabadi
f09971f10b Tweak classification so it does not classify things as keywords that could not actually be keywords according to the grammar. 2014-09-30 14:35:07 -07:00
Daniel Rosenwasser
4ed6a80c9c Limited identifying identifiers after dots to keywords. 2014-09-26 09:46:14 -07:00
Daniel Rosenwasser
a3b59f88c1 Fix issue where trivia is incorrectly identified as an identifier following a dot.
Fixes #753
2014-09-25 22:28:02 -07:00
Daniel Rosenwasser
25170ef5dd Changed wording for unit tests. 2014-09-23 14:14:27 -07:00
Daniel Rosenwasser
c719100f69 Added test cases for multiline comments in line classification. 2014-09-23 14:13:43 -07:00
Daniel Rosenwasser
4493aa60eb Added unit test for property access colorization. 2014-09-23 13:59:55 -07:00
Daniel Rosenwasser
b2372c9e7b Fixed up colorization tests. 2014-09-23 12:23:33 -07:00
Mohamed Hegazy
4e17787cb5 Do not colorize a keyword following an identifier.<newLine> as it is likely an error scenario as the user is typing 2014-09-15 13:55:50 -07:00
Mohamed Hegazy
be47b94c8f clean up tests 2014-08-08 16:45:10 -07:00
Mohamed Hegazy
17c45ed986 revert changes to classify a keyword as an identifier if the last token is keyword 2014-08-08 16:43:31 -07:00
Mohamed Hegazy
ad9a87dfb6 Add some huristic optimization to not colorize a keyword if precceded by a dot or a keyword. this should handel cases for "a.var" or "module string { }" 2014-08-08 10:37:10 -07:00
Mohamed Hegazy
bae6ddd1b5 add unterminated multiline comment classification tests 2014-08-07 23:51:15 -07:00
Mohamed Hegazy
38cacc967f Enable unit tests for DocumentRegistry 2014-08-07 23:45:43 -07:00
Mohamed Hegazy
d502ae20e5 move formatting unit tests to a diffrent folder 2014-08-07 23:45:23 -07:00
Mohamed Hegazy
05d2e75e7c delete unused tests 2014-08-07 23:45:13 -07:00
Mohamed Hegazy
3fcd33ec32 Enable clorizer unit tests 2014-08-07 23:45:03 -07:00
Mohamed Hegazy
214df64e28 Add snapshot of compiler sources 2014-07-12 17:30:19 -07:00