Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException: Invalid range specified: (1, -1); #103

Closed
timja opened this issue Aug 20, 2022 · 4 comments · Fixed by #115
Closed

IllegalArgumentException: Invalid range specified: (1, -1); #103

timja opened this issue Aug 20, 2022 · 4 comments · Fixed by #115
Labels

Comments

@timja
Copy link
Member

timja commented Aug 20, 2022

Running Stapler plugin 2.0.7
IJ 2022.2
Build #IU-222.3345.118, built on July 26, 2022

I was alt+backspacing some words in Jelly and got this:

java.lang.IllegalArgumentException: Invalid range specified: (1, -1); 
	at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:231)
	at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:226)
	at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:222)
	at com.intellij.openapi.util.TextRange.<init>(TextRange.java:41)
	at com.intellij.openapi.util.TextRange.<init>(TextRange.java:30)
	at com.intellij.openapi.util.TextRange.create(TextRange.java:151)
	at com.intellij.openapi.util.TextRange.from(TextRange.java:146)
	at org.kohsuke.stapler.idea.JellyLanguageInjector.getLanguagesToInject(JellyLanguageInjector.java:50)
	at com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl.processInPlaceInjectorsFor(InjectedLanguageManagerImpl.java:442)
	at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.probeElementsUp(InjectedLanguageUtilBase.java:246)
	at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.enumerate(InjectedLanguageUtilBase.java:176)
	at com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl.enumerateEx(InjectedLanguageManagerImpl.java:326)
	at com.intellij.codeInsight.daemon.impl.LineMarkersPass.queryLineMarkersForInjected(LineMarkersPass.java:252)
	at com.intellij.codeInsight.daemon.impl.LineMarkersPass.queryProviders(LineMarkersPass.java:214)
	at com.intellij.codeInsight.daemon.impl.LineMarkersPass.lambda$doCollectInformation$3(LineMarkersPass.java:102)
	at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideInOneRoot(Divider.java:87)
	at com.intellij.codeInsight.daemon.impl.LineMarkersPass.doCollectInformation(LineMarkersPass.java:97)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:57)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:400)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1154)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:393)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:392)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:368)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:215)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:366)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:184)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

@timja timja added the bug label Aug 20, 2022
@duemir
Copy link
Member

duemir commented Aug 20, 2022

@timja was it in an existing file? Can you link the revision and tell a cursor position where to start alt+backspace-ing?

It looks like a language injector, so I am guessing you were deleting inline JS or CSS.

@timja
Copy link
Member Author

timja commented Aug 20, 2022

@duemir it was CSS

@timja
Copy link
Member Author

timja commented Aug 20, 2022

It was an existing file but I added the CSS.

This file:
https://github.com/jenkinsci/view-job-filters-plugin/blob/474792494893290f0b175df84605a5bfa6b19c46/src/main/resources/hudson/views/AbstractBuildTrendFilter/config.jelly#L7

With some inline styles that I was playing around with.

Something like:

style="width:10%;display: inline" on the text input and the alt+backspace on the inline word

@jgreffe
Copy link
Contributor

jgreffe commented Oct 8, 2022

Issue reproduced:

  • use IDEA ultimate edition, which contains the CSS plugin (only for ultimate)
  1. open any jelly file, and start typing:
<div style=
  1. here, two double-quotes are added, CSS language is injected and auto-completion works between double-quotes
<div style=""
  1. now, start typing an additional = next to to the previous =
<div style==""

=> error occurs

Creating a simple PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants