apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.62k stars 840 forks source link

Add TypeScript editor #1692

Closed jlahoda closed 4 years ago

jlahoda commented 4 years ago

An attempt to provide TypeScript editor features using the LSP client/server.

JaroslavTulach commented 4 years ago

I'd be interested in knowing, if the support works out of the box on GraalVM (which has node embedded). Can we have a test for that? There already is nbbuild/travis/scripting.sh which downloads GraalVM, so just add this module as another one to verify...

Of course I do understand that I can do it myself later, when this change gets merged.

jlahoda commented 4 years ago

Unless there are strong objections, I would like to merge tomorrow.

Chris2011 commented 4 years ago

Please see my comment:

Is there a specific reason why not bump the version to the latest ones? TypeScript is now at 3.7.2. Issues with compatibility to the LSP of TS?

It is now at 3.7.4.

jlahoda commented 4 years ago

I dunno - does it work with TypeScript 3.7.2.? The LSP server does not specify any dependency, as far as I can tell (which undermines a little the idea of a package manager, I think). I have no idea what is the compatibility of the packages, etc. Seemed to work with this version. If it works with another, should be reasonably easy to change.

jlahoda commented 4 years ago

FWIW, trying should be easy, esp. for someone who knows how things work in the TypeScript/JavaScript land - build from this branch, and then replace the package under webcommon/typescript-lsp/node_modules. Also, keeping the package(s) up-to-date does not require knowledge of Java (just a little mechanical knowledge of what to adjust in the build definitions), but knowledge of TypeScript is good to test if the thing works!

Chris2011 commented 4 years ago

Ok, thx for the info. Is there a possibilty to change the TypeScript version manually? The NBTS project has it, since a couple of versions, because this was a requested feature. So if this is possible, there is no need to update to the latest version, I mean sure it is, but if I need a newer version, I can do that by my own. A lot of stuff in the JS ecosystem changes in a very short time. Just as an info.

In the eco system of Node and TS and the TS Compiler and the LSP for that. like this is working in VS Code, it should work very well, I guess. It was just a question from me, I thought you have a problem with compatibilities with the LSP and TS, I didn't checked it by myself with other versions.

Chris2011 commented 4 years ago

FWIW, trying should be easy, esp. for someone who knows how things work in the TypeScript/JavaScript land - build from this branch, and then replace the package under webcommon/typescript-lsp/node_modules. Also, keeping the package(s) up-to-date does not require knowledge of Java (just a little mechanical knowledge of what to adjust in the build definitions), but knowledge of TypeScript is good to test if the thing works!

Yes it is, as I said, I just wanted to know whether you had compatibility issues or not :). Will try it out, when it is merged. Thx.

jlahoda commented 4 years ago

I've taken look at 3.7.4. The licensing seems more complex, and will likely need some time to disentangle. Is there a particular thing that requires 3.7.4?

Chris2011 commented 4 years ago

The jump from 2.8. to 3.7. is huge with 3.7. Optional Chaining and Nullish Coalescing are only 2 of an amount of features. I can't even give you all of the features from 2.8.* to 3.7.4 because it is huge. Just this link: https://www.typescriptlang.org/docs/handbook/release-notes/overview.html. So at the end it would be better to give the user the option via an option in the project properties to choose the specific TSC that I want. Like in the PHP projects where I can say I want this PHP version for my project or Java projects where I can choose a different JDK to compile. Here it is needed that the user, like me, install the newest TSC on my machine and set the executable to my project.

Chris2011 commented 4 years ago

IMHO, you can't set a specific version in the ecosystem of JS. If you use it today, in a week it could be obsolete. It is not like in Java, or in PHP. Just saying. I know that it is possible to change it, as you already said it, but it is not obvious to every user of NetBeans. I also need to research how to do that.

jlahoda commented 4 years ago

I guess someone who knows TypeScript would be a great help here. I know that the server can take the typescript from the project, but I have no idea which of the versions takes precedence (and if a project does not specify a typescript, then the server fails badly if not present somewhere else - but where is searches for it was always a complete mystery to me). And, in the end, this is not a NetBeans decision. This is the LSP server's decision, the maximum we could do is to communicate a user's preference to it, but NetBeans is doing nothing special here.

So, as this is not really Java, but rather TypeScript/JavaScript, where I am not an expert at all, it would be good if the expert would do whatever is necessary. I.e. there is no real Java knowledge needed anymore, I think - but TypeScript/JavaScript knowledge is required!

Chris2011 commented 4 years ago

Sure I would like to help here, let us talk in private, maybe via slack to just talk about the problems you have and what I can do. For now, maybe you can have a look into this plugin which was pretty straight forward but not maintained anymore: https://github.com/Everlaw/nbts You can also ping me via skype. Will send you a mail.

Chris2011 commented 4 years ago

Some things here like in node or sass or whatever we already have in NetBeans. First set the TSC global via Options (This is still possible via Maven and I think Ant, due to netbeans comes with its own ant and maven version). So here it is fine to define a specific TSC like you did with 2.8.* so that the LSP for TS can work like a charm. And now it needs to be possible to change the version per project. This could be an idea. If there is no project dependent TSC, use the global one.

jlahoda commented 4 years ago

Well, I just tried - when my package.json specified typescript 2.8.3, I did npm install and restarted the IDE, then it seemed to work as 2.8.3. If I changed the version to 3.7.4, npm install, restart, it seemed to work as 3.7.4. So the included version is (I'd hope) mostly a backup when there is no typescript in the project (in which case it wouldn't compile? no idea here.)?

Chris2011 commented 4 years ago

Yes, there is definetely no problem to have 2.8.3 as a backup if there is no other version. I mean it is the same on the local machine. I can npm install typescript global and project specific. So thats fine. The user only needs to have the option to change the TS version to a custom one or the project TSC needs to take over the NetBeans one :). So if this is still possible, w/o having a special gui for than I would say merge.

Hope the restart is not needed, when I change the version in my project to another one or up/downgrade if I have some trouble with version compatibilites. Just asking.

jlahoda commented 4 years ago

So - did you try?

Chris2011 commented 4 years ago

I'm testing it now. Just to let you know.

Chris2011 commented 4 years ago

Also an info, I saw the icon, it is somehow self created? We should use the official logo. If the license is ok, we can use the same as the NBTS plugin did: https://github.com/Everlaw/nbts/blob/master/src/netbeanstypescript/resources/typescript.png or I personally prefer one of these: https://github.com/vscode-icons/vscode-icons/blob/master/icons/file_type_typescript.svg or this https://github.com/vscode-icons/vscode-icons/blob/master/icons/file_type_typescript_official.svg but to be in the general UI with NetBeans, I'm fine to use the NBTS icon.

Chris2011 commented 4 years ago

@jlahoda @matthiasblaesing is this ok for use: https://github.com/Everlaw/nbts/issues/151#issuecomment-573156212

In short:

It's just an edit of NetBeans 8.0.2's JS icon and may be used under the terms of the CDDL version 1.0 and/or the GPL version 2.0 with Classpath Exception.

It is about this icon: https://github.com/Everlaw/nbts/blob/master/src/netbeanstypescript/resources/typescript.png from the nbts plugin.

Chris2011 commented 4 years ago

The original javascript filetype icon, that he mentioned is this: https://github.com/apache/netbeans/blob/master/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/resources/javascript.png

junichi11 commented 4 years ago

I created a similar icon when I tried creating a TS plugin for a long time ago. typescript

javascript.png should be the AL2.0 now. So, I can change the license of my icon to AL2.0, I think. Please use it if needed.

matthiasblaesing commented 4 years ago

@junichi11 s variant looks sane from my perspective. The less we have to document the better. We can use CDDL licensed icons (to my understanding), but if not needed we should stay away from it.

Chris2011 commented 4 years ago

Cool, thx @junichi11

jlahoda commented 4 years ago

Thanks @junichi11, looks great! From the process point of view, it might be best if we pushed whatever icon is there, and then you'd submit a PR with the new icon. If not possible, it would be possible to in this PR, but the final commit message would need to be carefully crafted to make it clear there's your contribution as well.

Chris2011 commented 4 years ago

@jlahoda I got a NPE when I do this:

org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request textDocument/documentSymbol failed with message: Error processing request. No Project.
Error: No Project.
    at Object.ThrowNoProject (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:124630:23)
    at IOSession.Session.getFileAndLanguageServiceForSyntacticOperation (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:130979:42)
    at IOSession.Session.getNavigationTree (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131338:31)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:130198:61)
    at c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131671:88
    at IOSession.Session.executeWithRequestId (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131662:28)
    at IOSession.Session.executeCommand (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131671:33)
    at IOSession.Session.onMessage (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131693:35)
    at Interface.<anonymous> (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:132984:27)
    at Interface.emit (events.js:198:13)
    at Interface._onLine (readline.js:308:10)
    at Interface._normalWrite (readline.js:451:12)
    at Socket.ondata (readline.js:165:10)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:192)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Caused: java.util.concurrent.ExecutionException
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
[catch] at org.netbeans.modules.lsp.client.bindings.NavigatorPanelImpl.run(NavigatorPanelImpl.java:142)
    at org.netbeans.modules.lsp.client.LSPBindings.lambda$addBackgroundTask$6(LSPBindings.java:245)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

This is my project: https://github.com/Chris2011/Vue-TypeScript-Live-Search-Sample. I wrote code insie of the main.ts file.

Chris2011 commented 4 years ago

And when I try to open the main.ts file, I got this exception:

org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request textDocument/documentSymbol failed with message: Error processing request. No Project.
Error: No Project.
    at Object.ThrowNoProject (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:124630:23)
    at IOSession.Session.getFileAndLanguageServiceForSyntacticOperation (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:130979:42)
    at IOSession.Session.getNavigationTree (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131338:31)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:130198:61)
    at c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131671:88
    at IOSession.Session.executeWithRequestId (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131662:28)
    at IOSession.Session.executeCommand (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131671:33)
    at IOSession.Session.onMessage (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131693:35)
    at Interface.<anonymous> (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:132984:27)
    at Interface.emit (events.js:198:13)
    at Interface._onLine (readline.js:308:10)
    at Interface._normalWrite (readline.js:451:12)
    at Socket.ondata (readline.js:165:10)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:192)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Caused: java.util.concurrent.ExecutionException
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
[catch] at org.netbeans.modules.lsp.client.bindings.NavigatorPanelImpl.run(NavigatorPanelImpl.java:142)
    at org.netbeans.modules.lsp.client.LSPBindings.lambda$addBackgroundTask$6(LSPBindings.java:245)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

I see smth like No project but it is an HTML5 project, created with NetBeans.

Chris2011 commented 4 years ago

Just to be clear, it is a clean clone of netbeans, I built it, opened typescript.editor, built it and run the project. It opens a new instance.

After I wrote this snippet: const test = {}; at the end of the file main.ts I got several exceptions:

java.lang.AssertionError
    at com.oracle.js.parser.Parser.verifyDestructuringBindingPattern(Unknown Source)
    at com.oracle.js.parser.Parser.verifyDestructuringParameterBindingPattern(Unknown Source)
    at com.oracle.js.parser.Parser.verifyArrowParameter(Unknown Source)
    at com.oracle.js.parser.Parser.convertArrowFunctionParameterList(Unknown Source)
    at com.oracle.js.parser.Parser.arrowFunction(Unknown Source)
    at com.oracle.js.parser.Parser.assignmentExpression(Unknown Source)
    at com.oracle.js.parser.Parser.assignmentExpression(Unknown Source)
    at com.oracle.js.parser.Parser.expression(Unknown Source)
    at com.oracle.js.parser.Parser.expression(Unknown Source)
    at com.oracle.js.parser.Parser.expressionStatement(Unknown Source)
    at com.oracle.js.parser.Parser.statement(Unknown Source)
    at com.oracle.js.parser.Parser.sourceElements(Unknown Source)
    at com.oracle.js.parser.Parser.program(Unknown Source)
    at com.oracle.js.parser.Parser.parse(Unknown Source)
    at com.oracle.js.parser.Parser.parse(Unknown Source)
    at org.netbeans.modules.javascript2.editor.parser.JsParser.parseSource(JsParser.java:106)
    at org.netbeans.modules.javascript2.editor.parser.JsParser.parseSource(JsParser.java:33)
    at org.netbeans.modules.javascript2.editor.parser.SanitizingParser.parseContext(SanitizingParser.java:225)
    at org.netbeans.modules.javascript2.editor.parser.SanitizingParser.parseContext(SanitizingParser.java:205)
    at org.netbeans.modules.javascript2.editor.parser.SanitizingParser.parseSource(SanitizingParser.java:118)
    at org.netbeans.modules.javascript2.editor.parser.SanitizingParser.parse(SanitizingParser.java:78)
    at org.netbeans.modules.parsing.impl.TaskProcessor.callParse(TaskProcessor.java:598)
    at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:228)
    at org.netbeans.modules.parsing.api.ResultIterator.getParserResult(ResultIterator.java:115)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$2.run(RepositoryUpdater.java:3171)
    at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586)
    at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:130)
    at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:114)
    at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181)
    at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178)
    at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
    at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
    at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
    at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
    at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178)
    at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:81)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.indexEmbedding(RepositoryUpdater.java:3143)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doIndex(RepositoryUpdater.java:2862)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.access$800(RepositoryUpdater.java:2154)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2636)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2634)
    at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.refreshTransaction(TaskCache.java:540)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.index(RepositoryUpdater.java:2634)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5714)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5622)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$4.run(RepositoryUpdater.java:2127)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2123)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2104)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.access$1500(RepositoryUpdater.java:136)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSource(RepositoryUpdater.java:5749)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSources(RepositoryUpdater.java:5419)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$RootsWork.getDone(RepositoryUpdater.java:5038)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$InitialRootsWork.getDone(RepositoryUpdater.java:5821)
[catch] at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doTheWork(RepositoryUpdater.java:3420)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task._run(RepositoryUpdater.java:6183)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.access$4300(RepositoryUpdater.java:5834)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2$1.run(RepositoryUpdater.java:6099)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
    at org.netbeans.modules.parsing.impl.RunWhenScanFinishedSupport.performScan(RunWhenScanFinishedSupport.java:83)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6095)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6091)
    at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
    at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
    at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
    at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.run(RepositoryUpdater.java:6091)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

An empty NPE

and this one:

java.lang.NullPointerException
    at org.netbeans.modules.javascript2.model.JsObjectImpl.addAssignment(JsObjectImpl.java:272)
    at org.netbeans.modules.javascript2.nodejs.editor.model.NodeJsObjectInterceptor.interceptGlobal(NodeJsObjectInterceptor.java:73)
    at org.netbeans.modules.javascript2.model.api.Model.getModelVisitor(Model.java:179)
    at org.netbeans.modules.javascript2.model.api.Model.getGlobalObject(Model.java:468)
    at org.netbeans.modules.javascript2.editor.index.JsIndexer.index(JsIndexer.java:96)
    at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor$3.run(Indexable.java:225)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runIndexer(RepositoryUpdater.java:275)
    at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor.index(Indexable.java:223)
[catch] at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$2.run(RepositoryUpdater.java:3209)
    at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586)
    at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:130)
    at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:114)
    at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181)
    at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178)
    at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
    at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
    at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
    at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
    at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178)
    at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:81)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.indexEmbedding(RepositoryUpdater.java:3143)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doIndex(RepositoryUpdater.java:2862)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.access$800(RepositoryUpdater.java:2154)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2636)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2634)
    at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.refreshTransaction(TaskCache.java:540)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.index(RepositoryUpdater.java:2634)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5714)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5622)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$4.run(RepositoryUpdater.java:2127)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2123)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2104)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.access$1500(RepositoryUpdater.java:136)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSource(RepositoryUpdater.java:5749)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSources(RepositoryUpdater.java:5419)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$RootsWork.getDone(RepositoryUpdater.java:5038)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$InitialRootsWork.getDone(RepositoryUpdater.java:5821)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doTheWork(RepositoryUpdater.java:3420)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task._run(RepositoryUpdater.java:6183)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.access$4300(RepositoryUpdater.java:5834)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2$1.run(RepositoryUpdater.java:6099)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
    at org.netbeans.modules.parsing.impl.RunWhenScanFinishedSupport.performScan(RunWhenScanFinishedSupport.java:83)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6095)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6091)
    at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
    at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
    at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
    at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.run(RepositoryUpdater.java:6091)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
Chris2011 commented 4 years ago

So the current implementation is not that stable to use IMHO.

Chris2011 commented 4 years ago

When I type test. hitting ctrl + space, I got immediately a NPE:

java.lang.NullPointerException
    at org.netbeans.modules.lsp.client.bindings.CompletionProviderImpl$2.query(CompletionProviderImpl.java:161)
    at org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:198)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
Caused: org.openide.util.RequestProcessor$FastItem: task failed due to
Chris2011 commented 4 years ago

I opened a second project and when I type smth in a ts file, doesn't matter which one, after each typing, I got this message:

org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request textDocument/documentSymbol failed with message: Cannot call write after a stream was destroyed
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:192)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Caused: java.util.concurrent.ExecutionException
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
[catch] at org.netbeans.modules.lsp.client.bindings.NavigatorPanelImpl.run(NavigatorPanelImpl.java:142)
    at org.netbeans.modules.lsp.client.LSPBindings.lambda$addBackgroundTask$6(LSPBindings.java:245)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

Will try to make a minimal reproducable task, because I can't share the other project.

Chris2011 commented 4 years ago

But yes at the end, it seems that the project ts version overrides the hardcoded one. I tried Optional Chaining and Nullish Coalescing features and no errors in the editor. So this is ok. But because of the other problems, I couldn't check whether a restart of NetBeans is needed or not.

This is the end of my research for now.

junichi11 commented 4 years ago

@jlahoda Please feel free to push it to this PR since I don't mind about the contribution of the icon. If there is a problem, please write something about the icon in the commit message, as you wrote the above. Anyway, I'll provide the icon as Apache License, Version 2.0 :) Thanks.

jlahoda commented 4 years ago

When I type test. hitting ctrl + space, I got immediately a NPE:

java.lang.NullPointerException
  at org.netbeans.modules.lsp.client.bindings.CompletionProviderImpl$2.query(CompletionProviderImpl.java:161)
  at org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:198)
  at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
  at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
  at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
  at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
Caused: org.openide.util.RequestProcessor$FastItem: task failed due to

I've fixed that in a commit a few minutes ago - the code completion won't show anything, of course, as the server didn't return anything, but there won't be any exception.

jlahoda commented 4 years ago

Just to be clear, it is a clean clone of netbeans, I built it, opened typescript.editor, built it and run the project. It opens a new instance.

After I wrote this snippet: const test = {}; at the end of the file main.ts I got several exceptions:

java.lang.AssertionError
  at com.oracle.js.parser.Parser.verifyDestructuringBindingPattern(Unknown Source)
  at com.oracle.js.parser.Parser.verifyDestructuringParameterBindingPattern(Unknown Source)
  at com.oracle.js.parser.Parser.verifyArrowParameter(Unknown Source)
  at com.oracle.js.parser.Parser.convertArrowFunctionParameterList(Unknown Source)
  at com.oracle.js.parser.Parser.arrowFunction(Unknown Source)
  at com.oracle.js.parser.Parser.assignmentExpression(Unknown Source)
  at com.oracle.js.parser.Parser.assignmentExpression(Unknown Source)
  at com.oracle.js.parser.Parser.expression(Unknown Source)
  at com.oracle.js.parser.Parser.expression(Unknown Source)
  at com.oracle.js.parser.Parser.expressionStatement(Unknown Source)
  at com.oracle.js.parser.Parser.statement(Unknown Source)
  at com.oracle.js.parser.Parser.sourceElements(Unknown Source)
  at com.oracle.js.parser.Parser.program(Unknown Source)
  at com.oracle.js.parser.Parser.parse(Unknown Source)
  at com.oracle.js.parser.Parser.parse(Unknown Source)
  at org.netbeans.modules.javascript2.editor.parser.JsParser.parseSource(JsParser.java:106)
  at org.netbeans.modules.javascript2.editor.parser.JsParser.parseSource(JsParser.java:33)
  at org.netbeans.modules.javascript2.editor.parser.SanitizingParser.parseContext(SanitizingParser.java:225)
  at org.netbeans.modules.javascript2.editor.parser.SanitizingParser.parseContext(SanitizingParser.java:205)
  at org.netbeans.modules.javascript2.editor.parser.SanitizingParser.parseSource(SanitizingParser.java:118)
  at org.netbeans.modules.javascript2.editor.parser.SanitizingParser.parse(SanitizingParser.java:78)
  at org.netbeans.modules.parsing.impl.TaskProcessor.callParse(TaskProcessor.java:598)
  at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:228)
  at org.netbeans.modules.parsing.api.ResultIterator.getParserResult(ResultIterator.java:115)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$2.run(RepositoryUpdater.java:3171)
  at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586)
  at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:130)
  at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:114)
  at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181)
  at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178)
  at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
  at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
  at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
  at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
  at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178)
  at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:81)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.indexEmbedding(RepositoryUpdater.java:3143)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doIndex(RepositoryUpdater.java:2862)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.access$800(RepositoryUpdater.java:2154)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2636)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2634)
  at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.refreshTransaction(TaskCache.java:540)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.index(RepositoryUpdater.java:2634)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5714)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5622)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$4.run(RepositoryUpdater.java:2127)
  at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2123)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2104)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.access$1500(RepositoryUpdater.java:136)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSource(RepositoryUpdater.java:5749)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSources(RepositoryUpdater.java:5419)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$RootsWork.getDone(RepositoryUpdater.java:5038)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$InitialRootsWork.getDone(RepositoryUpdater.java:5821)
[catch] at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doTheWork(RepositoryUpdater.java:3420)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task._run(RepositoryUpdater.java:6183)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.access$4300(RepositoryUpdater.java:5834)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2$1.run(RepositoryUpdater.java:6099)
  at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
  at org.netbeans.modules.parsing.impl.RunWhenScanFinishedSupport.performScan(RunWhenScanFinishedSupport.java:83)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6095)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6091)
  at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
  at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
  at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
  at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.run(RepositoryUpdater.java:6091)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
  at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
  at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
  at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

An empty NPE

and this one:

java.lang.NullPointerException
  at org.netbeans.modules.javascript2.model.JsObjectImpl.addAssignment(JsObjectImpl.java:272)
  at org.netbeans.modules.javascript2.nodejs.editor.model.NodeJsObjectInterceptor.interceptGlobal(NodeJsObjectInterceptor.java:73)
  at org.netbeans.modules.javascript2.model.api.Model.getModelVisitor(Model.java:179)
  at org.netbeans.modules.javascript2.model.api.Model.getGlobalObject(Model.java:468)
  at org.netbeans.modules.javascript2.editor.index.JsIndexer.index(JsIndexer.java:96)
  at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor$3.run(Indexable.java:225)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runIndexer(RepositoryUpdater.java:275)
  at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor.index(Indexable.java:223)
[catch] at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$2.run(RepositoryUpdater.java:3209)
  at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586)
  at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:130)
  at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:114)
  at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181)
  at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178)
  at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
  at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
  at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
  at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
  at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178)
  at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:81)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.indexEmbedding(RepositoryUpdater.java:3143)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doIndex(RepositoryUpdater.java:2862)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.access$800(RepositoryUpdater.java:2154)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2636)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2634)
  at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.refreshTransaction(TaskCache.java:540)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.index(RepositoryUpdater.java:2634)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5714)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5622)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$4.run(RepositoryUpdater.java:2127)
  at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2123)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2104)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.access$1500(RepositoryUpdater.java:136)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSource(RepositoryUpdater.java:5749)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSources(RepositoryUpdater.java:5419)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$RootsWork.getDone(RepositoryUpdater.java:5038)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$InitialRootsWork.getDone(RepositoryUpdater.java:5821)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doTheWork(RepositoryUpdater.java:3420)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task._run(RepositoryUpdater.java:6183)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.access$4300(RepositoryUpdater.java:5834)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2$1.run(RepositoryUpdater.java:6099)
  at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
  at org.netbeans.modules.parsing.impl.RunWhenScanFinishedSupport.performScan(RunWhenScanFinishedSupport.java:83)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6095)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6091)
  at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
  at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
  at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
  at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
  at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.run(RepositoryUpdater.java:6091)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
  at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
  at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
  at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

Sorry, but these two don't seem to be related to TypeScript at all. Are you sure it doesn't happen on a recent master build?

jlahoda commented 4 years ago

And when I try to open the main.ts file, I got this exception:

org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request textDocument/documentSymbol failed with message: Error processing request. No Project.
Error: No Project.
    at Object.ThrowNoProject (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:124630:23)
    at IOSession.Session.getFileAndLanguageServiceForSyntacticOperation (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:130979:42)
    at IOSession.Session.getNavigationTree (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131338:31)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:130198:61)
    at c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131671:88
    at IOSession.Session.executeWithRequestId (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131662:28)
    at IOSession.Session.executeCommand (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131671:33)
    at IOSession.Session.onMessage (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:131693:35)
    at Interface.<anonymous> (c:\Projekte\Others\Vue TypeScript Live Search Sample\node_modules\typescript\lib\tsserver.js:132984:27)
    at Interface.emit (events.js:198:13)
    at Interface._onLine (readline.js:308:10)
    at Interface._normalWrite (readline.js:451:12)
    at Socket.ondata (readline.js:165:10)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
  at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
  at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
  at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:192)
  at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
  at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:748)
Caused: java.util.concurrent.ExecutionException
  at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
  at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
[catch] at org.netbeans.modules.lsp.client.bindings.NavigatorPanelImpl.run(NavigatorPanelImpl.java:142)
  at org.netbeans.modules.lsp.client.LSPBindings.lambda$addBackgroundTask$6(LSPBindings.java:245)
  at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
  at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
  at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
  at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
  at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

I see smth like No project but it is an HTML5 project, created with NetBeans.

I believe this is resolved by: https://github.com/apache/netbeans/pull/1833 (although it is again the case of no data from the server -> nothing to show - but I believe this particular server refuses to return the data at the beginning and then starts to provide them, so it should show the navigator content eventually.)

Chris2011 commented 4 years ago

I believe this is resolved by: #1833 (although it is again the case of no data from the server -> nothing to show - but I believe this particular server refuses to return the data at the beginning and then starts to provide them, so it should show the navigator content eventually.)

Ok, so before we can merge this to get it into the next version, we need to wait for the merge for #1833. IMHO, to fix this bug before this PR.

Sorry, but these two don't seem to be related to TypeScript at all. Are you sure it doesn't happen on a recent master build?

So I cloned netbeans, built it on master, used the command line instructions to get your PR, opened typescript.editor built just this project and run it into a new IDE build with JDK 1.8 with a clean testuserdir. I think everything is inside of the nbbuild folder for that, right? But ok, if you say that this is not related to TS then I'm fine with that.

Chris2011 commented 4 years ago

@jlahoda so as far as I can see, you merged the dependent PR. So then we can merge this too after adding the icon frum junichi :)