Giter VIP home page Giter VIP logo

Comments (9)

SimonIT avatar SimonIT commented on July 30, 2024

I can't reproduce the error. I can type :: without any error and the text behind it is marked as comment how it should.

from idea-batch.

WebMechanic avatar WebMechanic commented on July 30, 2024

That's "unfortunate" 'cos it happens to me on any .cmd file.
Which got me thinking while writing this ...

  • It works if the file name suffix is .bat

That's unfortunate, too, 'cos I use .cmd since Windows NT 4 to distinguish them from Win 9.x files back in the days. AFAIK that's also the recommended suffix for NT-ish flavours since ever.

from idea-batch.

WebMechanic avatar WebMechanic commented on July 30, 2024

addendum: if I creat e .bat file and rename it to .cmd (Shift+F6) it still works.
It only breaks if the file suffix was .cmd in the first place.

from idea-batch.

SimonIT avatar SimonIT commented on July 30, 2024

That's crazy.
Maybe you can provide a PR?
Another odd thing is, that in your provided stack trace no classes of this plugin are mentioned. So I don't think it's a problem of this plugin.

from idea-batch.

WebMechanic avatar WebMechanic commented on July 30, 2024

I just dumped the log that poped up when the editor broke.
Not sure if something else happend at the same moment or if I missed an entry.

To make things more okkult: once I renamed the test .bat back and forth to .cmd all existing .cmd files suddenly worked as well in the same session.
If I restart PhpStorm (Invalidate Caches and Restart) things break again.

This time I got two backtraces:
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'tokenType' of com/intellij/openapi/editor/ex/util/LexerEditorHighlighter.getAttributes must not be null

com.intellij.openapi.editor.ex.util.LexerEditorHighlighter$InvalidStateException: com.intellij.openapi.editor.ex.util.LexerEditorHighlighter(org.intellij.lang.batch.lexer.BatchHighlighterLexer): Error updating after DocumentEventImpl[myOffset=123, myOldLength=1, myNewLength=0, myOldString='

The second is followed by a truncated ("... 43 more")
Caused by: java.lang.IndexOutOfBoundsException: Wrong offset: 123. Should be in range: [0, 112]

Both mention the "Lexer" as in the JetBrain forum.
I can post the full log for both if that's of any help.

from idea-batch.

SimonIT avatar SimonIT commented on July 30, 2024

Yes, please post the full stack traces

java.lang.IllegalArgumentException: Argument for @NotNull parameter 'tokenType' of com/intellij/openapi/editor/ex/util/LexerEditorHighlighter.getAttributes must not be null

This is inside of intellij if you look at the package com/intellij/openapi

The second one is more interesting thought, because there is our package org.intellij.lang.batch mentioned

from idea-batch.

WebMechanic avatar WebMechanic commented on July 30, 2024

There you go; it stops after the "... 43 more" though:

com.intellij.openapi.editor.ex.util.LexerEditorHighlighter$InvalidStateException: 
com.intellij.openapi.editor.ex.util.LexerEditorHighlighter(org.intellij.lang.batch.lexer.BatchHighlighterLexer): 
Error updating  after DocumentEventImpl[myOffset=123, myOldLength=1, myNewLength=0, myOldString='
', myNewString=''].
	at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.documentChanged(LexerEditorHighlighter.java:337)
	at com.intellij.openapi.editor.impl.DocumentImpl.changedUpdate(DocumentImpl.java:899)
	at com.intellij.openapi.editor.impl.DocumentImpl.updateText(DocumentImpl.java:803)
	at com.intellij.openapi.editor.impl.DocumentImpl.deleteString(DocumentImpl.java:583)
	at com.intellij.openapi.command.impl.EditorChangeAction.exchangeStrings(EditorChangeAction.java:86)
	at com.intellij.openapi.command.impl.EditorChangeAction.performUndo(EditorChangeAction.java:63)
	at com.intellij.openapi.command.impl.EditorChangeAction.undo(EditorChangeAction.java:50)
	at com.intellij.openapi.command.impl.UndoableGroup.performActions(UndoableGroup.java:179)
	at com.intellij.openapi.command.impl.UndoableGroup.lambda$doUndoOrRedo$0(UndoableGroup.java:151)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:885)
	at com.intellij.openapi.command.impl.UndoableGroup.doUndoOrRedo(UndoableGroup.java:128)
	at com.intellij.openapi.command.impl.UndoableGroup.undoOrRedo(UndoableGroup.java:117)
	at com.intellij.openapi.command.impl.UndoableGroup.undo(UndoableGroup.java:96)
	at com.intellij.openapi.command.impl.Undo.performAction(Undo.java:40)
	at com.intellij.openapi.command.impl.UndoRedo.execute(UndoRedo.java:132)
	at com.intellij.openapi.command.impl.CommandMerger.undoOrRedo(CommandMerger.java:220)
	at com.intellij.openapi.command.impl.UndoManagerImpl.lambda$undoOrRedo$0(UndoManagerImpl.java:354)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:178)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:168)
	at com.intellij.openapi.command.impl.UndoManagerImpl.undoOrRedo(UndoManagerImpl.java:362)
	at com.intellij.openapi.command.impl.UndoManagerImpl.undo(UndoManagerImpl.java:337)
	at com.intellij.ide.actions.UndoAction.perform(UndoAction.java:30)
	at com.intellij.ide.actions.UndoRedoAction.actionPerformed(UndoRedoAction.java:43)
	at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:298)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:315)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:604)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$processAction$3(IdeKeyEventDispatcher.java:657)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:193)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:656)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:517)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:472)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:221)
	at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:830)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:775)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:424)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:698)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.IndexOutOfBoundsException: Wrong offset: 123. Should be in range: [0, 112]
	at com.intellij.openapi.editor.ex.util.SegmentArray.offsetOutOfRange(SegmentArray.java:90)
	at com.intellij.openapi.editor.ex.util.SegmentArray.findSegmentIndex(SegmentArray.java:104)
	at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.documentChanged(LexerEditorHighlighter.java:167)
	... 43 more

from idea-batch.

WebMechanic avatar WebMechanic commented on July 30, 2024

Here's another goodie.
Consider this content

@echo off
REM a remarkable remark
REM with two lines
echo %~0
goto :EOF

If I select any of the REM and type :: over the selection, it gets replaced as expected and everything is fine, the two colons show up and syntax highlighting stays intact.

If I put the cursor i.e. after the ECHO line, without making a selection, things break instantly after the first :.
Also the line beneath goto :EOF gets red squigly lines like a syntax error inspection, but there's neither a red lightbulp nor do Ctrl+F1 or Alt+Enter provide any insight.

Hope this helps!
Enjoy, good luck and stay healthy! 🤧😷

from idea-batch.

ArcSoul avatar ArcSoul commented on July 30, 2024

Hello, I am suffering the same problem and I can share my code

::===============================================================
:: Run Workflow to middle screen
::===============================================================

ECHO OFF

:: Windows Version Check
IF NOT "%OS%"=="Windows_NT" GOTO Syntax

START "" "C:\Users\AnthonyPC\AppData\Local\Postman\Postman.exe"
START "" "C:\Users\AnthonyPC\AppData\Local\Obsidian\Obsidian.exe"
START "" "C:\Users\AnthonyPC\OneDrive\Desktop\Programas\Outlook"
START chrome /profile-directory="Profile 3"
idea

EXIT

The problem is when I want to write :: before to START this considers all the code below as if it were the comment and highlights it in red, that is, it does not consider the line itself, but everything that is from that line down

image

from idea-batch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.