DragonKnightOfBreeze / Paradox-Language-Support

IDEA Plugin: Paradox Language Support.
https://windea.icu/Paradox-Language-Support
MIT License
37 stars 4 forks source link

Inline scripts hightlight issue when used in economic_categories and game_concepts #26

Closed adriangaro closed 1 year ago

adriangaro commented 1 year ago

For example, the bellow works, but the trigger block is highlighted in red, most likely due to being multiline

image

In concepts, everything is highlighted as wrong.

image

adriangaro commented 1 year ago

Other places with similar highlighting issues is inside policies (ie making an inline to quickly create some repetitive policy options)

Example:

image

adriangaro commented 1 year ago

Another place where inline scripts do not highlight correctly is economic_plans

image

DragonKnightOfBreeze commented 1 year ago

This is because:

adriangaro commented 1 year ago

Mutltiline strings are supported for inlines, since it has been recommended by Caligula at some point. Other places where multiline strings are supported are basically (almost) all meta script locations/uses, meaning scripted triggers and effects both accept it too. Script values do not accept it due to their one-liner nature (using the |PARAM|value| syntax)

DragonKnightOfBreeze commented 1 year ago

Not only for parameter values, but just for common keys and values.

adriangaro commented 1 year ago

One I can think of is log effect, can try to see how it handles that; most others do not really get strings (maybe set_name too). Will test myself a bit to see if the game complains and report here.

adriangaro commented 1 year ago

Also a bug related to multi line quoted strings, the formatter fails when pasting inlines with em/formatting files with the following:

nonempty text is not covered by block in #Paradox Script #formatter
Range: [65809,65821], text fragment: [65809,65821]

com.intellij.diagnostic.PluginException:  [Plugin: icu.windea.pls]
    at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:23)
    at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:89)
    at com.intellij.formatting.RangesAssert.assertInvalidRanges(RangesAssert.java:59)
    at com.intellij.formatting.WhiteSpace.changeEndOffset(WhiteSpace.java:127)
    at com.intellij.formatting.InitialInfoBuilder.buildFrom(InitialInfoBuilder.java:132)
    at com.intellij.formatting.InitialInfoBuilder.doIteration(InitialInfoBuilder.java:212)
    at com.intellij.formatting.InitialInfoBuilder.iteration(InitialInfoBuilder.java:109)
    at com.intellij.formatting.engine.WrapBlocksState.doIteration(WrapBlocksState.java:47)
    at com.intellij.formatting.engine.State.iteration(State.java:25)
    at com.intellij.formatting.engine.StateProcessor.iteration(StateProcessor.java:26)
    at com.intellij.formatting.FormatProcessor.iteration(FormatProcessor.java:108)
    at com.intellij.formatting.FormatterImpl.buildProcessorAndWrapBlocks(FormatterImpl.java:404)
    at com.intellij.formatting.FormatterImpl.buildProcessorAndWrapBlocks(FormatterImpl.java:381)
    at com.intellij.formatting.FormatterImpl.getLineIndent(FormatterImpl.java:463)
    at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl$4.doPerform(CodeStyleManagerImpl.java:301)
    at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl$4.doPerform(CodeStyleManagerImpl.java:293)
    at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerRunnable.perform(CodeStyleManagerRunnable.java:92)
    at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.getLineIndent(CodeStyleManagerImpl.java:303)
    at com.intellij.psi.impl.source.codeStyle.lineIndent.FormatterBasedLineIndentProvider.getLineIndent(FormatterBasedLineIndentProvider.java:42)
    at com.intellij.application.options.CodeStyle.getLineIndent(CodeStyle.java:440)
    at com.intellij.codeInsight.editorActions.EnterHandler.adjustLineIndentNoCommit(EnterHandler.java:311)
    at com.intellij.codeInsight.editorActions.EnterHandler$DoEnterAction.run(EnterHandler.java:436)
    at com.intellij.codeInsight.editorActions.EnterHandler.executeWriteActionInner(EnterHandler.java:163)
    at com.intellij.codeInsight.editorActions.EnterHandler.lambda$executeWriteAction$0(EnterHandler.java:65)
    at com.intellij.psi.impl.source.PostprocessReformattingAspect.lambda$disablePostprocessFormattingInside$1(PostprocessReformattingAspect.java:122)
    at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:130)
    at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:121)
    at com.intellij.codeInsight.editorActions.EnterHandler.executeWriteAction(EnterHandler.java:64)
    at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:56)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:958)
    at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.doExecute(EditorWriteActionHandler.java:70)
    at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:202)
    at com.intellij.codeInsight.template.impl.editorActions.EnterHandler.executeWriteAction(EnterHandler.java:49)
    at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:56)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:958)
    at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.doExecute(EditorWriteActionHandler.java:70)
    at com.intellij.openapi.editor.actionSystem.EditorActionHandler.lambda$execute$2(EditorActionHandler.java:192)
    at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:89)
    at com.intellij.openapi.editor.actionSystem.EditorActionHandler.lambda$execute$3(EditorActionHandler.java:191)
    at com.intellij.openapi.editor.impl.CaretModelImpl.lambda$runForEachCaret$3(CaretModelImpl.java:310)
    at com.intellij.openapi.editor.impl.CaretModelImpl.doWithCaretMerging(CaretModelImpl.java:419)
    at com.intellij.openapi.editor.impl.CaretModelImpl.runForEachCaret(CaretModelImpl.java:319)
    at com.intellij.openapi.editor.impl.CaretModelImpl.runForEachCaret(CaretModelImpl.java:296)
    at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:189)
    at org.jetbrains.plugins.terminal.exp.TerminalEnterHandler.executeWriteAction(TerminalEnterHandler.kt:21)
    at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:56)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:958)
    at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.doExecute(EditorWriteActionHandler.java:70)
    at com.intellij.openapi.editor.actionSystem.EditorActionHandler.lambda$execute$4(EditorActionHandler.java:199)
    at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:89)
    at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:198)
    at com.intellij.xdebugger.impl.actions.handlers.XDebuggerSmartStepIntoHandler$SmartStepEditorActionHandler.doExecute(XDebuggerSmartStepIntoHandler.java:412)
    at com.intellij.openapi.editor.actionSystem.DynamicEditorActionHandler.doExecute(DynamicEditorActionHandler.java:63)
    at com.intellij.openapi.editor.actionSystem.EditorActionHandler.lambda$execute$4(EditorActionHandler.java:199)
    at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:89)
    at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:198)
    at com.intellij.openapi.editor.actionSystem.EditorAction.lambda$actionPerformed$0(EditorAction.java:93)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174)
    at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:102)
    at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:77)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:333)
    at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:47)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:585)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$9(IdeKeyEventDispatcher.java:707)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$10(IdeKeyEventDispatcher.java:707)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:356)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.doPerformActionInner(IdeKeyEventDispatcher.java:704)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:648)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:596)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:480)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:469)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:225)
    at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.kt:599)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:569)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:68)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:349)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:348)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:348)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:343)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:995)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:995)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$4(IdeEventQueue.kt:343)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:385)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
DragonKnightOfBreeze commented 1 year ago

The features about "Supports inline script usages directly in scripts files rather than definition declarations" and "Supports multiline quoted inline script parameter values" should be implemented, but the further features' implementation is still in process ...