clj-kondo

https://github.com/clj-kondo/clj-kondo
Stefan T 2020-10-14T17:57:33.170800Z

Hey @borkdude I’ve got another repeatable issue I’ve noticed with the vscode extension, java.lang.IndexOutOfBoundsException is being thrown when you type something invalid, such as adding a comment in the middle of a list, example: step 1: add an empty list

()
step2: add a semicolon inside the list
(;)
results: an error is shown in the clj-kondo output
[Error - 10:56:50 AM] java.lang.IndexOutOfBoundsException
	at clojure.lang.PersistentVector.arrayFor(PersistentVector.java:158)
	at clojure.lang.PersistentVector.nth(PersistentVector.java:162)
	at clojure.lang.RT.nth(RT.java:896)
	at clj_kondo.lsp_server.impl.server$finding__GT_Diagnostic.invokeStatic(server.clj:75)
	at clj_kondo.lsp_server.impl.server$lint_BANG_$fn__11576.invoke(server.clj:132)
	at clojure.core$mapv$fn__8445.invoke(core.clj:6912)
	at clojure.lang.PersistentVector.reduce(PersistentVector.java:343)
	at clojure.core$reduce.invokeStatic(core.clj:6827)
	at clojure.core$mapv.invokeStatic(core.clj:6903)
	at clj_kondo.lsp_server.impl.server$lint_BANG_.invokeStatic(server.clj:124)
	at clj_kondo.lsp_server.impl.server.LSPTextDocumentService.didChange(server.clj:153)
	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

borkdude 2020-10-14T18:02:16.171700Z

@stefan.toubia Thanks. This issue has been reported in the clj-kondo.lsp repo. The fix is pretty easy, PR welcome if you're up for it