question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StringIndexOutOfBounds when using auto-complete

See original GitHub issue

I’m getting this exception when PHPStorm tries to use auto-completion with psalm-language-server. Let me know if there’s anything I can add to help determine why this isn’t working as intended.

2019-02-25 17:28:36,894 [1067849]  ERROR - plication.impl.ApplicationImpl - String index out of range: -1 
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1967)
	at com.github.gtache.lsp.utils.DocumentUtils$.$anonfun$LSPPosToOffset$1(DocumentUtils.scala:82)
	at com.github.gtache.lsp.utils.DocumentUtils$.$anonfun$LSPPosToOffset$1$adapted(DocumentUtils.scala:78)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:963)
	at com.github.gtache.lsp.utils.ApplicationUtils$.computableReadAction(ApplicationUtils.scala:26)
	at com.github.gtache.lsp.utils.DocumentUtils$.LSPPosToOffset(DocumentUtils.scala:78)
	at com.github.gtache.lsp.editor.EditorEventManager.$anonfun$diagnostics$4(EditorEventManager.scala:443)
	at com.github.gtache.lsp.editor.EditorEventManager.$anonfun$diagnostics$4$adapted(EditorEventManager.scala:437)
	at scala.collection.Iterator.foreach(Iterator.scala:937)
	at scala.collection.Iterator.foreach$(Iterator.scala:937)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
	at scala.collection.IterableLike.foreach(IterableLike.scala:70)
	at scala.collection.IterableLike.foreach$(IterableLike.scala:69)
	at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
	at com.github.gtache.lsp.editor.EditorEventManager.$anonfun$diagnostics$1(EditorEventManager.scala:437)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
	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:745)
2019-02-25 17:28:36,894 [1067849]  ERROR - plication.impl.ApplicationImpl - PhpStorm 2018.3.4  Build #PS-183.5429.47 
2019-02-25 17:28:36,894 [1067849]  ERROR - plication.impl.ApplicationImpl - JDK: 1.8.0_152-release; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 
2019-02-25 17:28:36,894 [1067849]  ERROR - plication.impl.ApplicationImpl - OS: Linux 
2019-02-25 17:28:36,894 [1067849]  ERROR - plication.impl.ApplicationImpl - Plugin to blame: LSP Support version: 1.5.2 
2019-02-25 17:28:36,894 [1067849]  ERROR - plication.impl.ApplicationImpl - Last Action: EditorChooseLookupItemReplace 

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Nacomacommented, Mar 6, 2019

It’s difficult to say what the correct handling is.

I’ve opened an issue requesting clarification on the handling of negative positions.

0reactions
Nacomacommented, Apr 16, 2019

This appears to have been resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception in thread "AWT-EventQueue-0" java.lang ...
StringIndexOutOfBoundsException : String index out of range: 97 at java.lang.String.charAt(String.java:658) at Autocomplete$TrieAutocomplete.
Read more >
getting StringIndexOutOfBoundsException exception while ...
We are getting below error while opening a case instance from our application. We are using Pega 7.1.7. Please provide solution for this ......
Read more >
StringIndexOutOfBoundsException: length=22; index=23 #1509
SO solution is to disable autofill for all EditTexts using v26/styles.xml , but this seems too severe. The bug only impacts a few...
Read more >
StringIndexOutOfBoundsException - Android Developers
Constructs a StringIndexOutOfBoundsException with the specified detail message. StringIndexOutOfBoundsException(int index).
Read more >
Java Program to Handle StringIndexOutofBoundsException ...
Java program to handle StringIndexOutOfBoundsException public class Main { public ... React.js Autocomplete Search Textfield in Browser Using Javascript and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found