Hi Gorkem,
Many thanks for your answer!
At first I would like to speak about VSCode which is very very fast even with big files. Why it is so fast when file is edited? The answer is that it doesn't parse the file to build an AST for syntax coloration, folding, match bracket, etc.
So when you open a big js, typescript, json file in VSCode the editor display the content of the file without syntax coloration. The compute of the token (done with TextMate and cached) is done in background and when compute is finished, the editor is colorized. With Eclipse which uses tokens scanner we have not this problem, because it's very very fast even with big file.
With JSDT 2.0.0 editor, the open of
https://github.com/Microsoft/TypeScript/blob/master/lib/tsserver.js takes 30 seconds every time (not only the first time). So my conclusion is that when a file is opened in the editor, it must NOT parse the content of JS file to create an AST like JSDT does. The parse of the AST should be done in background.
But you will tell me that if we do that, we loose some feature like code folding which is based on AST (IJavaElement). How VSCode support folding without building an AST? The answer is that VSCode cheat a little:) It support folding by using indentation. So if you write:
---------------------------
function a() {
var b;
}
---------------------------
The folding is done for function. But if you write
---------------------------
function a() {
var b;
}
---------------------------
The folding is not done. I like this idea and I will implement it in my own editor.
So I have decided to implement my own editor but based on some JSDT features like syntax coloration by using _javascript_TextTools. I tell me if JSDT could provide a lightweight JavaScritpt editor which supports commons features like syntax coloration, folding, match bracket which don't need the use of the AST.
The JavaEditor could extend this lightweight editor and build an AST (on background if possible). After that other project could use this lightweight _javascript_ editor.
In other words, I think _javascript_ editor should never parse the content of the opened file to build an AST in order to that when user opens a big files, the editor doesn't freeze. The AST should be done in background and completion should be available only when this AST is built.
Perhaps I'm missing something, but it's my first feeling. What do you think about this idea?
Regard's Angelo