├── .github └── workflows │ ├── ci.yml │ └── clean.yml ├── .gitignore ├── .idea ├── .gitignore └── codeStyles │ └── codeStyleConfig.xml ├── LICENSE.txt ├── README.md ├── build.sbt ├── img ├── autocompletion.gif ├── breadcrumbs.png ├── classreferences.gif ├── gotoprevnext.gif ├── includeresolution.gif ├── movestatement.gif ├── quickdoc.png ├── stringlitrefs.gif ├── substitutionresolution.gif └── syntaxhighlighting.png ├── project ├── build.properties └── plugins.sbt ├── resources ├── META-INF │ ├── hocon-java.xml │ └── plugin.xml ├── colorSchemes │ ├── HoconDarcula.xml │ └── HoconDefault.xml └── icons │ ├── property.png │ └── property.svg ├── src └── org │ └── jetbrains │ └── plugins │ └── hocon │ ├── HoconConstants.scala │ ├── codestyle │ ├── HoconCodeStyleSettingsProvider.scala │ ├── HoconCustomCodeStyleSettings.java │ └── HoconLanguageCodeStyleSettingsProvider.scala │ ├── editor │ ├── EnterInHashCommentHandler.scala │ ├── HoconCommentJoinLinesHandler.scala │ ├── HoconCommenter.scala │ ├── HoconEnterBetweenBracesHandler.scala │ ├── HoconObjectEntryMover.scala │ └── HoconQuoteHandler.scala │ ├── formatting │ ├── HoconBlock.scala │ ├── HoconFormatter.scala │ └── HoconFormattingModelBuilder.scala │ ├── highlight │ ├── HoconColorSettingsPage.scala │ ├── HoconHighlightUsagesHandlerFactory.scala │ ├── HoconHighlighterColors.scala │ ├── HoconSyntaxHighlighter.scala │ └── HoconSyntaxHighlightingAnnotator.scala │ ├── indexing │ └── indices.scala │ ├── lang │ ├── HoconFileType.scala │ └── HoconLanguage.scala │ ├── lexer │ ├── HoconLexer.scala │ ├── HoconTokenSets.scala │ └── HoconTokenType.scala │ ├── manipulators │ ├── HKeyManipulator.scala │ └── HStringManipulator.scala │ ├── misc │ ├── HoconBraceMatcher.scala │ ├── HoconBreadcrumbsInfoProvider.scala │ ├── HoconDocumentationProvider.scala │ └── HoconFoldingBuilder.scala │ ├── navigation │ ├── HoconFindUsagesHandler.scala │ ├── HoconGotoSymbolContributor.scala │ ├── HoconReadWriteAccessDetector.scala │ └── gotoHandlers.scala │ ├── package.scala │ ├── parser │ ├── HoconElementSets.scala │ ├── HoconElementType.scala │ ├── HoconErrorHighlightingAnnotator.scala │ ├── HoconParserDefinition.scala │ └── HoconPsiParser.scala │ ├── psi │ ├── HoconPsiElement.scala │ └── HoconPsiElementFactory.scala │ ├── ref │ ├── HKeyReference.scala │ ├── HStringJavaClassReferenceProvider.scala │ ├── HoconIncludeResolutionInspection.scala │ ├── HoconJavaReferenceContributor.scala │ ├── HoconPropertiesReferenceProvider.scala │ ├── HoconPropertyLookupElement.scala │ ├── HoconQualifiedNameProvider.scala │ ├── HoconReferenceContributor.scala │ ├── IncludedFileReferenceProvider.scala │ ├── IncludedFileReferenceSet.scala │ └── PackageDirsEnumerator.scala │ ├── semantics │ ├── ConfigValue.scala │ └── ResolutionCtx.scala │ └── settings │ ├── HoconProjectSettings.scala │ ├── HoconProjectSettingsConfigurable.scala │ ├── HoconProjectSettingsPanel.form │ └── HoconProjectSettingsPanel.java ├── test └── org │ └── jetbrains │ └── plugins │ └── hocon │ ├── HoconActionTest.scala │ ├── HoconFileSetTestCase.scala │ ├── HoconMultiModuleTest.scala │ ├── HoconSingleModuleTest.scala │ ├── HoconTestUtils.scala │ ├── TestSuiteCompanion.scala │ ├── completion │ └── HoconCompletionTest.scala │ ├── editor │ └── HoconEditorActionTest.scala │ ├── formatting │ └── HoconFormatterTest.scala │ ├── includes │ ├── HoconIncludeResolutionTest.scala │ ├── HoconMultiModuleIncludeResolutionTest.scala │ └── HoconSingleModuleIncludeResolutionTest.scala │ ├── lexer │ └── HoconLexerTest.scala │ ├── manipulators │ └── HoconManipulatorTest.scala │ ├── navigation │ └── HoconNavigationTest.scala │ ├── parser │ └── HoconParserTest.scala │ ├── ref │ ├── HoconCopyReferenceTest.scala │ ├── JavaClassReferenceTest.scala │ └── JavaLiteralHoconReferenceTest.scala │ ├── resolution │ └── HoconResolutionTest.scala │ └── usages │ ├── HoconFindUsagesTest.scala │ └── HoconHighlightUsagesTest.scala └── testdata ├── actions ├── copyReference │ ├── nested.test │ ├── nestedInArray.test │ ├── nestedInner.test │ ├── simple.test │ ├── simpleInner.test │ ├── substitution.test │ └── substitutionInner.test ├── enter │ ├── braces.test │ ├── brackets.test │ ├── doubleSlashEnd.test │ ├── doubleSlashInside.test │ ├── enterBeforeHash.test │ ├── hashEnd.test │ ├── hashInside.test │ └── nested.test ├── gotoNext │ └── simple.test ├── gotoPrev │ └── simple.test ├── joinLines │ ├── hashSlash.test │ ├── moreSpaces.test │ ├── moveCaret.test │ ├── nested.test │ ├── nospace.test │ ├── simpleDoubleSlash.test │ ├── simpleHash.test │ └── slashHash.test ├── literalPaths │ └── simple.test ├── moveStatement │ ├── both │ │ ├── adjacent1.test │ │ ├── adjacent10.test │ │ ├── adjacent2.test │ │ ├── adjacent3.test │ │ ├── adjacent4.test │ │ ├── adjacent5.test │ │ ├── adjacent6.test │ │ ├── adjacent7.test │ │ ├── adjacent8.test │ │ ├── adjacent9.test │ │ ├── inout1.test │ │ ├── inout10.test │ │ ├── inout2.test │ │ ├── inout3.test │ │ ├── inout4.test │ │ ├── inout5.test │ │ ├── inout6.test │ │ ├── inout7.test │ │ ├── inout8.test │ │ └── inout9.test │ ├── down │ │ └── descend1.test │ └── up │ │ ├── adjacent1.test │ │ ├── adjacent10.test │ │ ├── adjacent2.test │ │ ├── adjacent3.test │ │ ├── adjacent4.test │ │ ├── adjacent5.test │ │ ├── adjacent6.test │ │ ├── adjacent7.test │ │ ├── adjacent8.test │ │ ├── adjacent9.test │ │ ├── inout1.test │ │ ├── inout10.test │ │ ├── inout2.test │ │ ├── inout3.test │ │ ├── inout4.test │ │ ├── inout5.test │ │ ├── inout6.test │ │ ├── inout7.test │ │ ├── inout8.test │ │ └── inout9.test └── substitution │ ├── circular.test │ ├── circular2.test │ ├── fullPath.test │ ├── innerSelfReferential.test │ ├── invalidPathPrefix.test │ ├── pathPrefix.test │ └── selfReferential.test ├── completion ├── included.conf ├── inner.conf ├── inner2.conf ├── innerSub.conf ├── toplevel.conf └── toplevelSub.conf ├── findUsages ├── modA │ ├── lib │ │ └── reference.conf │ ├── libsrc │ │ ├── libpkg │ │ │ └── LibMain.java │ │ └── reference.conf │ └── src │ │ ├── application.conf │ │ └── pkg │ │ └── Main.java └── modB │ ├── lib │ └── reference.conf │ ├── libsrc │ ├── blibpkg │ │ └── LibMain.java │ └── reference.conf │ └── src │ ├── application.conf │ └── bpkg │ └── Main.java ├── formatter ├── arraysAlignWhenMultiline.test ├── arraysNewLineAfterLbracket.test ├── arraysRbracketOnNextLine.test ├── arraysWrapAlways.test ├── arraysWrapChopDown.test ├── arraysWrapIfLong.test ├── arraysWrapNever.test ├── blankLines.test ├── indentation.test ├── keepCommentsAtFirstColumn.test ├── noKeepCommentsAtFirstColumn.test ├── noSpaceAfterAssignment.test ├── noSpaceAfterColon.test ├── noSpaceAfterComma.test ├── noSpaceAfterPathBeforeLbrace.test ├── noSpaceAfterQmark.test ├── noSpaceBeforeAssignment.test ├── noSpaceBeforeColon.test ├── noSpaceBeforeComma.test ├── noSpaceWithinBrackets.test ├── noSpaceWithinIncludeQualifierParens.test ├── noSpaceWithinObjectBraces.test ├── noSpaceWithinSubstitutionBraces.test ├── objectEntriesWrapAlways.test ├── objectEntriesWrapIfLong.test ├── objectEntriesWrapNever.test ├── objectFieldsAssignmentOnNextLine.test ├── objectFieldsColonOnNextLine.test ├── objectsAlignWhenMultiline.test ├── objectsNoNewLineAfterLbrace.test ├── objectsRbraceNotOnNextLine.test ├── objectsWrapAlways.test ├── objectsWrapChopDown.test ├── objectsWrapIfLong.test ├── objectsWrapNever.test ├── spaceAfterAssignment.test ├── spaceAfterColon.test ├── spaceAfterComma.test ├── spaceAfterPathBeforeLbrace.test ├── spaceAfterQmark.test ├── spaceBeforeAssignment.test ├── spaceBeforeColon.test ├── spaceBeforeComma.test ├── spaceWithinBrackets.test ├── spaceWithinIncludeQualifierParens.test ├── spaceWithinObjectBraces.test ├── spaceWithinSubstitutionBraces.test └── spacing.test ├── highlightUsages ├── differentTexts.conf ├── inArrayElement.conf ├── nested.conf ├── simple.conf └── single.conf ├── includes ├── multimodule │ ├── modA │ │ ├── lib │ │ │ ├── included.conf │ │ │ └── including.conf │ │ ├── libsrc │ │ │ ├── included.conf │ │ │ └── including.conf │ │ ├── src │ │ │ ├── included.conf │ │ │ └── including.conf │ │ ├── testlib │ │ │ ├── included.conf │ │ │ └── including.conf │ │ ├── testlibsrc │ │ │ ├── included.conf │ │ │ └── including.conf │ │ └── testsrc │ │ │ ├── included.conf │ │ │ └── including.conf │ ├── modB │ │ ├── lib │ │ │ ├── included.conf │ │ │ └── including.conf │ │ ├── libsrc │ │ │ ├── included.conf │ │ │ └── including.conf │ │ ├── src │ │ │ ├── included.conf │ │ │ └── including.conf │ │ ├── testlib │ │ │ ├── included.conf │ │ │ └── including.conf │ │ ├── testlibsrc │ │ │ ├── included.conf │ │ │ └── including.conf │ │ └── testsrc │ │ │ ├── included.conf │ │ │ └── including.conf │ └── modC │ │ ├── lib │ │ ├── included.conf │ │ └── including.conf │ │ ├── libsrc │ │ ├── included.conf │ │ └── including.conf │ │ ├── other │ │ ├── included.conf │ │ └── including.conf │ │ ├── src │ │ ├── included.conf │ │ └── including.conf │ │ ├── testlib │ │ ├── included.conf │ │ └── including.conf │ │ ├── testlibsrc │ │ ├── included.conf │ │ └── including.conf │ │ └── testsrc │ │ ├── included.conf │ │ └── including.conf └── singlemodule │ ├── included.conf │ ├── including.conf │ ├── pkg │ ├── included.conf │ └── including.conf │ ├── props │ └── included.properties │ ├── propsjson │ ├── included.json │ └── included.properties │ └── propsjsonconf │ ├── included.conf │ ├── included.json │ └── included.properties ├── javaClassRefs ├── application.conf └── pkg │ └── Main.java ├── javaLiteralRefs ├── application.conf └── pkg │ └── Main.java ├── lexer ├── SCL8593.test ├── assignment.test ├── badSubstitution.test ├── badchars.test ├── braces.test ├── brackets.test ├── comments.test ├── complex.test ├── dots.test ├── multiline.test ├── optionalSubstitution.test ├── quoting.test ├── substitution.test └── unclosedSubstitution.test ├── manipulators ├── key │ ├── dotAppearInKey.test │ ├── multipleParts.test │ ├── quotedWithEscaping.test │ ├── simpleInKey.test │ ├── simpleMultiline.test │ ├── simpleQuoted.test │ ├── simpleUnquoted.test │ ├── unquotedForbiddenChars.test │ ├── unquotedToEmpty.test │ ├── unquotedWhitespace.test │ └── unquotedWithEscaping.test └── string │ ├── dotAppearInKey.test │ ├── dotAppearInValue.test │ ├── quotedWithEscaping.test │ ├── simpleInInclude.test │ ├── simpleInKey.test │ ├── simpleMultiline.test │ ├── simpleQuoted.test │ ├── simpleUnquoted.test │ ├── unclosedQuoted.test │ ├── unquotedForbiddenChars.test │ ├── unquotedToEmpty.test │ ├── unquotedWhitespace.test │ └── unquotedWithEscaping.test ├── parser ├── array.test ├── badCharactersInKey.test ├── badCharactersInValue.test ├── badIncludeTarget.test ├── boolean.test ├── commentsBinding.test ├── concatenations.test ├── danglingComma.test ├── documentationComments.test ├── dollarInKey.test ├── dollarInPath.test ├── dollarInValue.test ├── dotsInValues.test ├── expectedArrayElement.test ├── expectedAssignment.test ├── expectedEof.test ├── expectedFieldValue.test ├── expectedObjectField.test ├── expectedObjectFieldToplevel.test ├── expectedPathInSub.test ├── expectedQuotedStringInclude.test ├── expectedRbrace.test ├── expectedRbracket.test ├── expectedRparen.test ├── expectedSubRbrace.test ├── fieldSeparators.test ├── include.test ├── includeModifierBadSpace.test ├── keyWhitespaceBinding.test ├── keyvalues.test ├── malformedUrl.test ├── multilineInclude.test ├── multilineKeyValue.test ├── multipleDotsInPath.test ├── nullValue.test ├── numbers.test ├── objectEntriesGreedyBinding.test ├── objects.test ├── path.test ├── stringconcat.test ├── substitutions.test ├── toplevelArray.test ├── toplevelObject.test ├── unclosedMultilineString.test ├── unclosedQuotedString.test ├── unexpectedTokenAfterValue.test └── unquotedInclude.test └── resolution ├── application.conf ├── included.conf ├── moreIncluded.conf ├── nestedIncluded.conf └── reference.conf /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/artifacts/ 2 | .idea/scopes/ 3 | .idea/dictionaries/ 4 | .idea/inspectionProfiles/ 5 | .idea/runConfigurations/ 6 | .idea/libraries/ 7 | .idea/modules/ 8 | .idea/codeStyles/ 9 | .idea/markdown-navigator/ 10 | .idea/.name 11 | .idea/*.xml 12 | .idea/shelf/ 13 | /target 14 | /*.bat 15 | *.class 16 | .DS_Store 17 | *~ 18 | target/ 19 | out/ 20 | .bsp 21 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /build.sbt: -------------------------------------------------------------------------------- 1 | import org.jetbrains.sbtidea.Keys._ 2 | 3 | ThisBuild / scalaVersion := "2.13.16" 4 | ThisBuild / intellijPluginName := "intellij-hocon" 5 | ThisBuild / intellijBuild := "251.17181.31" 6 | ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("17")) 7 | 8 | val junitInterfaceVersion = "0.13.3" 9 | val junitVersion = "4.13.2" 10 | val commonsTextVersion = "1.13.1" 11 | val opentest4jVersion = "1.3.0" 12 | 13 | lazy val hocon = project.in(file(".")).enablePlugins(SbtIdeaPlugin).settings( 14 | version := "2025.1.99-SNAPSHOT", 15 | Compile / scalaSource := baseDirectory.value / "src", 16 | Test / scalaSource := baseDirectory.value / "test", 17 | Compile / resourceDirectory := baseDirectory.value / "resources", 18 | Global / javacOptions ++= Seq("-source", "17", "-target", "17"), 19 | Global / scalacOptions ++= Seq( 20 | "-deprecation", 21 | "-feature", 22 | "-unchecked", 23 | "-Xfatal-warnings", 24 | ), 25 | ideBasePackages := Seq("org.jetbrains.plugins.hocon"), 26 | intellijPlugins := Seq("com.intellij.java", "com.intellij.java-i18n", "com.intellij.modules.json").map(_.toPlugin), 27 | libraryDependencies ++= Seq( 28 | "org.apache.commons" % "commons-text" % commonsTextVersion, 29 | "com.github.sbt" % "junit-interface" % junitInterfaceVersion % Test, 30 | "junit" % "junit" % junitVersion % Test, 31 | "org.opentest4j" % "opentest4j" % opentest4jVersion % Test, 32 | ), 33 | packageLibraryMappings := Seq.empty, // allow scala-library 34 | patchPluginXml := pluginXmlOptions { xml => 35 | xml.version = version.value 36 | } 37 | ) 38 | -------------------------------------------------------------------------------- /img/autocompletion.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/img/autocompletion.gif -------------------------------------------------------------------------------- /img/breadcrumbs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/img/breadcrumbs.png -------------------------------------------------------------------------------- /img/classreferences.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/img/classreferences.gif -------------------------------------------------------------------------------- /img/gotoprevnext.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/img/gotoprevnext.gif -------------------------------------------------------------------------------- /img/includeresolution.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/img/includeresolution.gif -------------------------------------------------------------------------------- /img/movestatement.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/img/movestatement.gif -------------------------------------------------------------------------------- /img/quickdoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/img/quickdoc.png -------------------------------------------------------------------------------- /img/stringlitrefs.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/img/stringlitrefs.gif -------------------------------------------------------------------------------- /img/substitutionresolution.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/img/substitutionresolution.gif -------------------------------------------------------------------------------- /img/syntaxhighlighting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/img/syntaxhighlighting.png -------------------------------------------------------------------------------- /project/build.properties: -------------------------------------------------------------------------------- 1 | # suppress inspection "UnusedProperty" for whole file 2 | sbt.version=1.10.11 3 | -------------------------------------------------------------------------------- /project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("org.jetbrains" % "sbt-idea-plugin" % "4.1.5") 2 | addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.2") 3 | addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.25.0") -------------------------------------------------------------------------------- /resources/META-INF/hocon-java.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /resources/colorSchemes/HoconDarcula.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 14 | 19 | -------------------------------------------------------------------------------- /resources/colorSchemes/HoconDefault.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 14 | -------------------------------------------------------------------------------- /resources/icons/property.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/resources/icons/property.png -------------------------------------------------------------------------------- /resources/icons/property.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Layer 1 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/HoconConstants.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | 3 | import com.intellij.json.JsonFileType 4 | import org.jetbrains.plugins.hocon.lang.HoconFileType 5 | 6 | object HoconConstants { 7 | final val Null = "null" 8 | final val True = "true" 9 | final val False = "false" 10 | final val Include = "include" 11 | 12 | final val UrlModifier = "url" 13 | final val FileModifier = "file" 14 | final val ClasspathModifier = "classpath" 15 | final val RequiredModifer = "required" 16 | final val IncludeLocationModifiers = Set(UrlModifier, FileModifier, ClasspathModifier) 17 | final val IncludeModifiers = IncludeLocationModifiers + RequiredModifer 18 | 19 | final val IntegerPattern = """-?(0|[1-9][0-9]*)""".r 20 | final val DecimalPartPattern = """([0-9]+)((e|E)(\+|-)?[0-9]+)?""".r 21 | final val ProperlyClosedQuotedString = ".*[^\\\\](\\\\\\\\)*\"".r 22 | final val MultilineStringEnd = "\"{3,}".r 23 | 24 | final val ConfExt = "." + HoconFileType.DefaultExtension 25 | final val JsonExt = "." + JsonFileType.DEFAULT_EXTENSION 26 | final val PropsExt = ".properties" 27 | } 28 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/codestyle/HoconCodeStyleSettingsProvider.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package codestyle 3 | 4 | import com.intellij.application.options.{CodeStyleAbstractConfigurable, TabbedLanguageCodeStylePanel} 5 | import com.intellij.psi.codeStyle.{CodeStyleConfigurable, CodeStyleSettings, CodeStyleSettingsProvider, DisplayPriority} 6 | import org.jetbrains.plugins.hocon.lang.HoconLanguage 7 | 8 | class HoconCodeStyleSettingsProvider extends CodeStyleSettingsProvider { 9 | 10 | override def getConfigurableDisplayName = "HOCON" 11 | 12 | override def getPriority = DisplayPriority.COMMON_SETTINGS 13 | 14 | override def createConfigurable(settings: CodeStyleSettings, modelSettings: CodeStyleSettings): CodeStyleConfigurable = 15 | new CodeStyleAbstractConfigurable(settings, modelSettings, "HOCON") { 16 | override protected def createPanel(settings: CodeStyleSettings): TabbedLanguageCodeStylePanel = 17 | new TabbedLanguageCodeStylePanel(HoconLanguage, getCurrentSettings, settings) {} 18 | } 19 | 20 | override def createCustomSettings(settings: CodeStyleSettings) = 21 | new HoconCustomCodeStyleSettings(settings) 22 | } 23 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/codestyle/HoconCustomCodeStyleSettings.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon.codestyle; 2 | 3 | import com.intellij.psi.codeStyle.CodeStyleSettings; 4 | import com.intellij.psi.codeStyle.CommonCodeStyleSettings; 5 | import com.intellij.psi.codeStyle.CustomCodeStyleSettings; 6 | 7 | public class HoconCustomCodeStyleSettings extends CustomCodeStyleSettings { 8 | public HoconCustomCodeStyleSettings(CodeStyleSettings container) { 9 | super("HoconCodeStyleSettings", container); 10 | } 11 | 12 | // SPACING 13 | // Around operators 14 | public boolean SPACE_BEFORE_COLON = false; 15 | public boolean SPACE_AFTER_COLON = true; 16 | public boolean SPACE_BEFORE_ASSIGNMENT = true; 17 | public boolean SPACE_AFTER_ASSIGNMENT = true; 18 | // Before left brace 19 | public boolean SPACE_BEFORE_LBRACE_AFTER_PATH = true; 20 | // Within 21 | public boolean SPACE_WITHIN_SUBSTITUTION_BRACES = false; 22 | // Other 23 | public boolean SPACE_AFTER_QMARK = false; 24 | 25 | //WRAPPING AND BRACES 26 | //Keep when reformatting 27 | public boolean HASH_COMMENTS_AT_FIRST_COLUMN = false; 28 | public boolean DOUBLE_SLASH_COMMENTS_AT_FIRST_COLUMN = false; 29 | 30 | public int OBJECTS_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP; 31 | public boolean OBJECTS_ALIGN_WHEN_MULTILINE = false; 32 | public boolean OBJECTS_NEW_LINE_AFTER_LBRACE = true; 33 | public boolean OBJECTS_RBRACE_ON_NEXT_LINE = true; 34 | 35 | public int LISTS_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP; 36 | public boolean LISTS_ALIGN_WHEN_MULTILINE = false; 37 | public boolean LISTS_NEW_LINE_AFTER_LBRACKET = false; 38 | public boolean LISTS_RBRACKET_ON_NEXT_LINE = false; 39 | 40 | public int OBJECT_FIELDS_WITH_COLON_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP; 41 | public boolean OBJECT_FIELDS_COLON_ON_NEXT_LINE = false; 42 | 43 | public int OBJECT_FIELDS_WITH_ASSIGNMENT_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP; 44 | public boolean OBJECT_FIELDS_ASSIGNMENT_ON_NEXT_LINE = false; 45 | 46 | public int INCLUDED_RESOURCE_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP; 47 | 48 | //BLANK LINES 49 | public int KEEP_BLANK_LINES_IN_OBJECTS = 2; 50 | public int KEEP_BLANK_LINES_IN_LISTS = 2; 51 | public int KEEP_BLANK_LINES_BEFORE_RBRACE = 2; 52 | public int KEEP_BLANK_LINES_BEFORE_RBRACKET = 2; 53 | } 54 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/editor/HoconCommentJoinLinesHandler.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon.editor 2 | 3 | import com.intellij.codeInsight.editorActions.JoinLinesHandlerDelegate.CANNOT_JOIN 4 | import com.intellij.codeInsight.editorActions.JoinRawLinesHandlerDelegate 5 | import com.intellij.openapi.editor.Document 6 | import com.intellij.psi.{PsiFile, PsiWhiteSpace} 7 | import org.jetbrains.plugins.hocon.lexer.{HoconTokenSets, HoconTokenType} 8 | import org.jetbrains.plugins.hocon.psi.HoconPsiFile 9 | 10 | import scala.annotation.tailrec 11 | 12 | /** 13 | * HOCON line comments can start with either '//' or '#'. Unfortunately, only one of them can be declared in 14 | * [[HoconCommenter]] and so I need this custom join lines handler to properly handle both. 15 | */ 16 | class HoconCommentJoinLinesHandler extends JoinRawLinesHandlerDelegate { 17 | def tryJoinRawLines(document: Document, file: PsiFile, start: Int, end: Int): Int = file match { 18 | case _: HoconPsiFile => file.findElementAt(start) match { 19 | case ws: PsiWhiteSpace => 20 | val prev = ws.getPrevSibling 21 | val next = ws.getNextSibling 22 | val prevType = prev.getNode.getElementType 23 | val nextType = next.getNode.getElementType 24 | val line = document.getLineNumber(start) 25 | 26 | if (document.getLineNumber(prev.getTextOffset) == line && 27 | document.getLineNumber(next.getTextOffset) == line + 1 && 28 | HoconTokenSets.Comment.contains(prevType) && 29 | HoconTokenSets.Comment.contains(nextType)) { 30 | 31 | val charSeq = document.getCharsSequence 32 | val endOffset = next.getTextRange.getEndOffset 33 | @tailrec def nextLineNewStart(idx: Int): Int = { 34 | if (idx >= endOffset) idx 35 | else if (charSeq.charAt(idx).isWhitespace) nextLineNewStart(idx + 1) 36 | else idx 37 | } 38 | 39 | val firstIdx = nextType match { 40 | case HoconTokenType.HashComment => end + 1 41 | case HoconTokenType.DoubleSlashComment => end + 2 42 | } 43 | document.replaceString(start, nextLineNewStart(firstIdx), " ") 44 | start 45 | } 46 | else CANNOT_JOIN 47 | case _ => 48 | CANNOT_JOIN 49 | } 50 | case _ => CANNOT_JOIN 51 | } 52 | 53 | def tryJoinLines(document: Document, file: PsiFile, start: Int, end: Int): Int = 54 | CANNOT_JOIN 55 | } 56 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/editor/HoconCommenter.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package editor 3 | 4 | import com.intellij.lang.CodeDocumentationAwareCommenter 5 | import com.intellij.psi.PsiComment 6 | import com.intellij.psi.tree.IElementType 7 | import org.jetbrains.plugins.hocon.lexer.HoconTokenType 8 | 9 | class HoconCommenter extends CodeDocumentationAwareCommenter { 10 | def getLineCommentPrefix = "//" 11 | 12 | def getLineCommentTokenType: IElementType = HoconTokenType.DoubleSlashComment 13 | 14 | def getBlockCommentSuffix = null 15 | 16 | def getBlockCommentPrefix = null 17 | 18 | def getCommentedBlockCommentPrefix = null 19 | 20 | def getCommentedBlockCommentSuffix = null 21 | 22 | def getDocumentationCommentLinePrefix: String = null 23 | 24 | def getBlockCommentTokenType: IElementType = null 25 | 26 | def getDocumentationCommentTokenType: IElementType = null 27 | 28 | def isDocumentationComment(element: PsiComment): Boolean = false 29 | 30 | def getDocumentationCommentSuffix: String = null 31 | 32 | def getDocumentationCommentPrefix: String = null 33 | } 34 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/editor/HoconEnterBetweenBracesHandler.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package editor 3 | 4 | import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate.Result 5 | import com.intellij.codeInsight.editorActions.enter.{EnterBetweenBracesHandler, EnterHandlerDelegate} 6 | import com.intellij.openapi.actionSystem.DataContext 7 | import com.intellij.openapi.editor.Editor 8 | import com.intellij.openapi.editor.actionSystem.EditorActionHandler 9 | import com.intellij.openapi.util.Ref 10 | import com.intellij.psi.PsiFile 11 | import org.jetbrains.plugins.hocon.lang.HoconLanguage 12 | 13 | import scala.annotation.nowarn 14 | 15 | /** 16 | * Like [[com.intellij.json.formatter.JsonEnterBetweenBracesHandler]] 17 | * 18 | * @author ghik 19 | */ 20 | @nowarn("msg=deprecated") 21 | class HoconEnterBetweenBracesHandler extends EnterBetweenBracesHandler { 22 | override def preprocessEnter( 23 | file: PsiFile, editor: Editor, caretOffsetRef: Ref[Integer], 24 | caretAdvance: Ref[Integer], dataContext: DataContext, 25 | originalHandler: EditorActionHandler 26 | ): Result = 27 | if (file.getLanguage is HoconLanguage) 28 | super.preprocessEnter(file, editor, caretOffsetRef, caretAdvance, dataContext, originalHandler) 29 | else 30 | EnterHandlerDelegate.Result.Continue 31 | 32 | override def isBracePair(c1: Char, c2: Char): Boolean = 33 | c1 == '{' && c2 == '}' || c1 == '[' && c2 == ']' 34 | } 35 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/editor/HoconQuoteHandler.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package editor 3 | 4 | import com.intellij.codeInsight.editorActions.{JavaLikeQuoteHandler, SimpleTokenSetQuoteHandler} 5 | import com.intellij.openapi.editor.highlighter.HighlighterIterator 6 | import com.intellij.psi.PsiElement 7 | import com.intellij.psi.tree.{IElementType, TokenSet} 8 | import org.jetbrains.plugins.hocon.lexer.HoconTokenType 9 | 10 | class HoconQuoteHandler extends SimpleTokenSetQuoteHandler(HoconTokenType.QuotedString) with JavaLikeQuoteHandler { 11 | 12 | override protected def isNonClosedLiteral(iterator: HighlighterIterator, chars: CharSequence) = 13 | iterator.getStart >= iterator.getEnd - 1 || chars.charAt(iterator.getEnd - 1) != '\"' 14 | 15 | def getConcatenatableStringTokenTypes = TokenSet.EMPTY 16 | 17 | def getStringConcatenationOperatorRepresentation = null 18 | 19 | def getStringTokenTypes: TokenSet = myLiteralTokenSet 20 | 21 | def needParenthesesAroundConcatenation(element: PsiElement) = false 22 | 23 | def isAppropriateElementTypeForLiteral(tokenType: IElementType) = true 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/formatting/HoconBlock.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package formatting 3 | 4 | import java.util 5 | 6 | import com.intellij.formatting._ 7 | import com.intellij.lang.ASTNode 8 | import com.intellij.psi.TokenType 9 | import com.intellij.psi.formatter.common.AbstractBlock 10 | import org.jetbrains.plugins.hocon.lexer.HoconTokenSets 11 | import org.jetbrains.plugins.hocon.parser.HoconElementType 12 | 13 | class HoconBlock(formatter: HoconFormatter, node: ASTNode, indent: Indent, wrap: Wrap, alignment: Alignment) 14 | extends AbstractBlock(node, wrap, alignment) { 15 | 16 | // HoconFormatter needs these to be able to return exactly the same instances of Wrap and Alignment for 17 | // children of this block 18 | private val wrapCache = { 19 | val pathValueSeparatorType = 20 | if (node.getElementType == HoconElementType.ValuedField) 21 | node.childrenIterator.map(_.getElementType).find(HoconTokenSets.KeyValueSeparator.contains) 22 | else None 23 | new formatter.WrapCache(pathValueSeparatorType) 24 | } 25 | private val alignmentCache = new formatter.AlignmentCache 26 | 27 | override def getIndent: Indent = indent 28 | 29 | override def getChildAttributes(newChildIndex: Int) = 30 | new ChildAttributes(formatter.getChildIndent(node), formatter.getChildAlignment(alignmentCache, node)) 31 | 32 | def buildChildren(): util.List[Block] = children.asJava 33 | 34 | def isLeaf: Boolean = 35 | formatter.getChildren(node).isEmpty 36 | 37 | def getSpacing(child1: Block, child2: Block): Spacing = 38 | if (child1 == null) 39 | formatter.getFirstSpacing(node, child2.asInstanceOf[HoconBlock].getNode) 40 | else 41 | formatter.getSpacing(node, child1.asInstanceOf[HoconBlock].getNode, child2.asInstanceOf[HoconBlock].getNode) 42 | 43 | lazy val children: Seq[Block] = 44 | formatter.getChildren(node) 45 | .filterNot(n => n.getTextLength == 0 || n.getElementType == TokenType.WHITE_SPACE) 46 | .map(createChildBlock).toVector 47 | 48 | private def createChildBlock(child: ASTNode) = 49 | new HoconBlock(formatter, child, 50 | formatter.getIndent(node, child), 51 | formatter.getWrap(wrapCache, node, child), 52 | formatter.getAlignment(alignmentCache, node, child)) 53 | 54 | override def toString: String = 55 | s"${node.getElementType}[${node.getText.replace("\n", "\\n")}]${node.getTextRange}" + { 56 | if (isLeaf) "" else children.mkString("\n", "\n", "").indent(" ") 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/formatting/HoconFormattingModelBuilder.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package formatting 3 | 4 | import com.intellij.formatting.{FormattingContext, FormattingModelBuilder} 5 | import com.intellij.lang.ASTNode 6 | import com.intellij.openapi.util.TextRange 7 | import com.intellij.psi.PsiFile 8 | import com.intellij.psi.formatter.{FormattingDocumentModelImpl, PsiBasedFormattingModel} 9 | 10 | class HoconFormattingModelBuilder extends FormattingModelBuilder { 11 | override def createModel(context: FormattingContext): PsiBasedFormattingModel = { 12 | val element = context.getPsiElement 13 | val containingFile = element.getContainingFile 14 | val block = new HoconBlock(new HoconFormatter(context.getCodeStyleSettings), element.getNode, null, null, null) 15 | new PsiBasedFormattingModel(containingFile, block, FormattingDocumentModelImpl.createOn(containingFile)) 16 | } 17 | 18 | override def getRangeAffectingIndent(file: PsiFile, offset: Int, elementAtOffset: ASTNode): TextRange = 19 | elementAtOffset.getTextRange 20 | } 21 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/highlight/HoconHighlightUsagesHandlerFactory.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package highlight 3 | 4 | import navigation.HoconFindUsagesHandler 5 | import psi._ 6 | 7 | import com.intellij.codeInsight.highlighting.{HighlightUsagesHandlerBase, HighlightUsagesHandlerFactoryBase} 8 | import com.intellij.openapi.editor.Editor 9 | import com.intellij.psi.{PsiElement, PsiFile} 10 | import com.intellij.util.Consumer 11 | 12 | import java.{util => ju} 13 | 14 | class HoconHighlightUsagesHandlerFactory extends HighlightUsagesHandlerFactoryBase { 15 | def createHighlightUsagesHandler(editor: Editor, file: PsiFile, target: PsiElement): HoconHighlightKeyUsagesHandler = 16 | target.parentOfType[HKey].map(new HoconHighlightKeyUsagesHandler(editor, _)).orNull 17 | } 18 | 19 | class HoconHighlightKeyUsagesHandler(editor: Editor, hkey: HKey) 20 | extends HighlightUsagesHandlerBase[HKey](editor, hkey.hoconFile) { 21 | 22 | def computeUsages(targets: JList[_ <: HKey]): Unit = for { 23 | target <- targets.iterator.asScala 24 | foundKey <- HoconFindUsagesHandler.localUsagesOf(target) 25 | usageList = if (foundKey.inField) myWriteUsages else myReadUsages 26 | } { 27 | usageList.add(foundKey.getTextRange) 28 | } 29 | 30 | def getTargets: JList[HKey] = ju.Collections.singletonList(hkey) 31 | 32 | def selectTargets(targets: JList[_ <: HKey], selectionConsumer: Consumer[_ >: JList[_ <: HKey]]): Unit = 33 | selectionConsumer.consume(targets) 34 | } 35 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/highlight/HoconHighlighterColors.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package highlight 3 | 4 | import com.intellij.openapi.editor.colors.TextAttributesKey 5 | import com.intellij.openapi.editor.{HighlighterColors, DefaultLanguageHighlighterColors => DLHC} 6 | 7 | object HoconHighlighterColors { 8 | final val BadCharacter = key("HOCON_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER) 9 | final val HashComment = key("HOCON_HASH_COMMENT", DLHC.LINE_COMMENT) 10 | final val DoubleSlashComment = key("HOCON_DOUBLE_SLASH_COMMENT", DLHC.LINE_COMMENT) 11 | final val Null = key("HOCON_NULL", DLHC.KEYWORD) 12 | final val Boolean = key("HOCON_BOOLEAN", DLHC.KEYWORD) 13 | final val Number = key("HOCON_NUMBER", DLHC.NUMBER) 14 | final val QuotedString = key("HOCON_QUOTED_STRING", DLHC.STRING) 15 | final val MultilineString = key("HOCON_MULTILINE_STRING", DLHC.STRING) 16 | final val ValidStringEscape = key("HOCON_VALID_STRING_ESCAPE", DLHC.VALID_STRING_ESCAPE) 17 | final val InvalidStringEscape = key("HOCON_INVALID_STRING_ESCAPE", DLHC.INVALID_STRING_ESCAPE) 18 | final val Brackets = key("HOCON_BRACKETS", DLHC.BRACKETS) 19 | final val Braces = key("HOCON_OBJECT_BRACES", DLHC.BRACES) 20 | final val IncludeModifierParens = key("HOCON_INCLUDE_MODIFIER_PARENS", DLHC.PARENTHESES) 21 | final val SubBraces = key("HOCON_SUBSTITUTION_BRACES", DLHC.BRACES) 22 | final val KeyValueSeparator = key("HOCON_KEY_VALUE_SEPARATOR", DLHC.OPERATION_SIGN) 23 | final val Comma = key("HOCON_COMMA", DLHC.COMMA) 24 | final val Include = key("HOCON_INCLUDE", DLHC.KEYWORD) 25 | final val IncludeModifier = key("HOCON_INCLUDE_MODIFIER", DLHC.IDENTIFIER) 26 | final val SubstitutionSign = key("HOCON_SUBSTITUTION_SIGN", DLHC.OPERATION_SIGN) 27 | final val OptionalSubstitutionSign = key("HOCON_OPTIONAL_SUBSTITUTION_SIGN", DLHC.OPERATION_SIGN) 28 | final val UnquotedString = key("HOCON_UNQUOTED_STRING", DLHC.IDENTIFIER) 29 | final val PathSeparator = key("PATH_SEPARATOR", DLHC.DOT) 30 | final val EntryKey = key("ENTRY_KEY", DLHC.INSTANCE_METHOD) 31 | final val SubstitutionKey = key("SUBSTITUTION_KEY", DLHC.INSTANCE_FIELD) 32 | 33 | private def key(name: String, prototype: TextAttributesKey) = 34 | TextAttributesKey.createTextAttributesKey(name, prototype) 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/highlight/HoconSyntaxHighlightingAnnotator.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package highlight 3 | 4 | import com.intellij.lang.annotation.{AnnotationHolder, Annotator, HighlightSeverity} 5 | import com.intellij.openapi.editor.colors.TextAttributesKey 6 | import com.intellij.psi.PsiElement 7 | 8 | class HoconSyntaxHighlightingAnnotator extends Annotator { 9 | 10 | import org.jetbrains.plugins.hocon.lexer.HoconTokenType._ 11 | import org.jetbrains.plugins.hocon.parser.HoconElementSets._ 12 | import org.jetbrains.plugins.hocon.parser.HoconElementType._ 13 | 14 | def annotate(element: PsiElement, holder: AnnotationHolder): Unit = { 15 | lazy val parentType = element.getParent.getNode.getElementType 16 | lazy val firstChildType = element.getFirstChild.getNode.getElementType 17 | 18 | def annot(attrs: TextAttributesKey): Unit = 19 | holder.newSilentAnnotation(HighlightSeverity.INFORMATION).range(element).textAttributes(attrs).create() 20 | 21 | element.getNode.getElementType match { 22 | case Null => 23 | annot(HoconHighlighterColors.Null) 24 | 25 | case Boolean => 26 | annot(HoconHighlighterColors.Boolean) 27 | 28 | case Number => 29 | annot(HoconHighlighterColors.Number) 30 | 31 | case UnquotedChars if parentType == Include => 32 | annot(HoconHighlighterColors.Include) 33 | 34 | case UnquotedChars if parentType == Included || parentType == QualifiedIncluded => 35 | annot(HoconHighlighterColors.IncludeModifier) 36 | 37 | case LParen | RParen if parentType == Included || parentType == QualifiedIncluded => 38 | annot(HoconHighlighterColors.IncludeModifierParens) 39 | 40 | case KeyPart if firstChildType == UnquotedString => 41 | val textAttributesKey = element.getParent.getParent.getNode.getElementType match { 42 | case Path => HoconHighlighterColors.SubstitutionKey 43 | case KeyedField.extractor() => HoconHighlighterColors.EntryKey 44 | } 45 | annot(textAttributesKey) 46 | 47 | case Period if parentType == Path || parentType == PrefixedField => 48 | annot(HoconHighlighterColors.PathSeparator) 49 | 50 | case _ => 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/lang/HoconFileType.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package lang 3 | 4 | import com.intellij.openapi.fileTypes.{FileType, LanguageFileType} 5 | import javax.swing.Icon 6 | 7 | final class HoconFileType extends LanguageFileType(HoconLanguage) { 8 | def getIcon: Icon = HoconIcon 9 | def getDefaultExtension: String = HoconFileType.DefaultExtension 10 | def getDescription = "HOCON" 11 | def getName = "HOCON" 12 | } 13 | object HoconFileType { 14 | final val DefaultExtension = "conf" 15 | 16 | def isHocon(fileType: FileType): Boolean = fileType match { 17 | case _: HoconFileType => true 18 | case _ => false 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/lang/HoconLanguage.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package lang 3 | 4 | import com.intellij.lang.Language 5 | 6 | object HoconLanguage extends Language("HOCON") 7 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/lexer/HoconTokenSets.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package lexer 3 | 4 | import com.intellij.psi.tree.TokenSet 5 | 6 | import scala.language.implicitConversions 7 | 8 | object HoconTokenSets { 9 | 10 | import org.jetbrains.plugins.hocon.lexer.HoconTokenType._ 11 | 12 | final val Empty = TokenSet.EMPTY 13 | final val Whitespace = InlineWhitespace | LineBreakingWhitespace 14 | final val Comment = HashComment | DoubleSlashComment 15 | final val WhitespaceOrComment = Whitespace | Comment 16 | final val StringLiteral = QuotedString | MultilineString 17 | final val KeyValueSeparator = Colon | Equals | PlusEquals 18 | final val ArrayElementsEnding = RBracket | RBrace 19 | final val ValueEnding = Comma | RBrace | RBracket 20 | final val PathEnding = KeyValueSeparator | LBrace | SubRBrace | ValueEnding 21 | final val KeyEnding = PathEnding | Period 22 | final val UnquotedCharsOrParens = UnquotedChars | LParen | RParen 23 | final val ValueUnquotedChars = UnquotedCharsOrParens | Period 24 | final val SimpleValuePart = UnquotedCharsOrParens | Period | StringLiteral 25 | final val PathStart = UnquotedCharsOrParens | StringLiteral | Period | Dollar | BadCharacter 26 | final val SubstitutionPathStart = PathStart | KeyValueSeparator 27 | final val ValueStart = SimpleValuePart | LBrace | LBracket | Dollar | KeyValueSeparator | BadCharacter 28 | final val ObjectEntryStart = PathStart | UnquotedCharsOrParens 29 | 30 | case class Matcher(tokenSet: TokenSet, requireNoNewLine: Boolean, matchNewLine: Boolean, matchEof: Boolean) { 31 | def noNewLine: Matcher = copy(requireNoNewLine = true) 32 | def orNewLineOrEof: Matcher = copy(matchNewLine = true, matchEof = true) 33 | def orEof: Matcher = copy(matchEof = true) 34 | } 35 | 36 | implicit def token2Matcher(token: HoconTokenType): Matcher = 37 | Matcher(TokenSet.create(token), requireNoNewLine = false, matchNewLine = false, matchEof = false) 38 | 39 | implicit def tokenSet2Matcher(tokenSet: TokenSet): Matcher = 40 | Matcher(tokenSet, requireNoNewLine = false, matchNewLine = false, matchEof = false) 41 | } 42 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/lexer/HoconTokenType.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package lexer 3 | 4 | import com.intellij.psi.TokenType 5 | import com.intellij.psi.tree.IElementType 6 | import org.jetbrains.plugins.hocon.lang.HoconLanguage 7 | 8 | sealed class HoconTokenType(debugString: String) extends IElementType(debugString, HoconLanguage) 9 | 10 | object HoconTokenType extends TokenType { 11 | final val InlineWhitespace = new HoconTokenType("INLINE_WHITESPACE") 12 | final val LineBreakingWhitespace = new HoconTokenType("LINE_BREAKING_WHITESPACE") 13 | final val BadCharacter = new HoconTokenType("BAD_CHARACTER") 14 | final val LBrace = new HoconTokenType("LBRACE") 15 | final val RBrace = new HoconTokenType("RBRACE") 16 | final val LBracket = new HoconTokenType("LBRACKET") 17 | final val RBracket = new HoconTokenType("RBRACKET") 18 | final val LParen = new HoconTokenType("LPAREN") 19 | final val RParen = new HoconTokenType("RPAREN") 20 | final val Colon = new HoconTokenType("COLON") 21 | final val Comma = new HoconTokenType("COMMA") 22 | final val Equals = new HoconTokenType("EQUALS") 23 | final val PlusEquals = new HoconTokenType("PLUS_EQUALS") 24 | final val Period = new HoconTokenType("PERIOD") 25 | final val Dollar = new HoconTokenType("DOLLAR") 26 | final val SubLBrace = new HoconTokenType("SUB_LBRACE") 27 | final val QMark = new HoconTokenType("QMARK") 28 | final val SubRBrace = new HoconTokenType("SUB_RBRACE") 29 | final val HashComment = new HoconTokenType("HASH_COMMENT") 30 | final val DoubleSlashComment = new HoconTokenType("DOUBLE_SLASH_COMMENT") 31 | final val UnquotedChars = new HoconTokenType("UNQUOTED_CHARS") 32 | final val QuotedString = new HoconTokenType("QUOTED_STRING") 33 | final val MultilineString = new HoconTokenType("MULTILINE_STRING") 34 | } 35 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/manipulators/HKeyManipulator.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package manipulators 3 | 4 | import com.intellij.openapi.util.TextRange 5 | import com.intellij.openapi.util.text.StringUtil 6 | import com.intellij.psi.{AbstractElementManipulator, PsiManager} 7 | import org.jetbrains.plugins.hocon.lexer.HoconLexer 8 | import org.jetbrains.plugins.hocon.psi.{HFieldKey, HKey, HSubstitutionKey, HoconPsiElementFactory} 9 | 10 | /** 11 | * @author ghik 12 | */ 13 | class HKeyManipulator extends AbstractElementManipulator[HKey] { 14 | 15 | import org.jetbrains.plugins.hocon.lexer.HoconTokenType._ 16 | 17 | def handleContentChange(key: HKey, range: TextRange, newContent: String): HKey = { 18 | val psiManager = PsiManager.getInstance(key.getProject) 19 | val allStringTypes = key.keyParts.map(_.stringType).toSet 20 | 21 | lazy val escapedContent = 22 | StringUtil.escapeStringCharacters(newContent) 23 | 24 | lazy val needsQuoting = 25 | newContent.isEmpty || newContent.startsWith(" ") || newContent.endsWith(" ") || 26 | escapedContent != newContent || newContent.exists(HoconLexer.KeyForbiddenChars.contains(_)) 27 | 28 | val quotedEscapedContent = 29 | if (allStringTypes.contains(MultilineString)) 30 | "\"\"\"" + newContent + "\"\"\"" 31 | else if (allStringTypes.contains(QuotedString) || needsQuoting) 32 | "\"" + escapedContent + "\"" 33 | else 34 | newContent 35 | 36 | val newKey = key match { 37 | case _: HFieldKey => HoconPsiElementFactory.createFieldKey(quotedEscapedContent, psiManager) 38 | case _: HSubstitutionKey => HoconPsiElementFactory.createSubstitutionKey(quotedEscapedContent, psiManager) 39 | } 40 | key.replace(newKey) 41 | newKey 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/misc/HoconBraceMatcher.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package misc 3 | 4 | import com.intellij.lang.{BracePair, PairedBraceMatcher} 5 | import com.intellij.psi.PsiFile 6 | import com.intellij.psi.tree.IElementType 7 | 8 | class HoconBraceMatcher extends PairedBraceMatcher { 9 | 10 | import org.jetbrains.plugins.hocon.lexer.HoconTokenSets._ 11 | import org.jetbrains.plugins.hocon.lexer.HoconTokenType._ 12 | 13 | def getPairs: Array[BracePair] = Array( 14 | new BracePair(LBrace, RBrace, true), 15 | new BracePair(LBracket, RBracket, false), 16 | new BracePair(SubLBrace, SubRBrace, false) 17 | ) 18 | 19 | private val AllowsPairedBraceBefore = 20 | WhitespaceOrComment | Comma | RBrace | RBracket 21 | 22 | def isPairedBracesAllowedBeforeType(lbraceType: IElementType, contextType: IElementType): Boolean = 23 | AllowsPairedBraceBefore.contains(contextType) 24 | 25 | def getCodeConstructStart(file: PsiFile, openingBraceOffset: Int): Int = 26 | openingBraceOffset 27 | } 28 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/misc/HoconBreadcrumbsInfoProvider.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package misc 3 | 4 | import com.intellij.psi.PsiElement 5 | import com.intellij.ui.breadcrumbs.BreadcrumbsProvider 6 | import org.jetbrains.plugins.hocon.lang.HoconLanguage 7 | import org.jetbrains.plugins.hocon.psi.HKeyedField 8 | 9 | class HoconBreadcrumbsInfoProvider extends BreadcrumbsProvider { 10 | 11 | def getElementInfo(e: PsiElement): String = e match { 12 | case kf: HKeyedField => kf.key.map(_.stringValue).getOrElse("") 13 | case _ => "" 14 | } 15 | 16 | def acceptElement(e: PsiElement): Boolean = e match { 17 | case _: HKeyedField => true 18 | case _ => false 19 | } 20 | 21 | def getLanguages = Array(HoconLanguage) 22 | } 23 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/misc/HoconFoldingBuilder.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package misc 3 | 4 | import com.intellij.lang.ASTNode 5 | import com.intellij.lang.folding.{FoldingBuilder, FoldingDescriptor} 6 | import com.intellij.openapi.editor.Document 7 | import com.intellij.psi.tree.TokenSet 8 | 9 | import scala.collection.mutable 10 | import scala.collection.mutable.ArrayBuffer 11 | 12 | class HoconFoldingBuilder extends FoldingBuilder { 13 | 14 | import org.jetbrains.plugins.hocon.lexer.HoconTokenType._ 15 | import org.jetbrains.plugins.hocon.parser.HoconElementType._ 16 | 17 | def buildFoldRegions(node: ASTNode, document: Document): Array[FoldingDescriptor] = { 18 | val foldableTypes = TokenSet.create(Object, Array, MultilineString) 19 | 20 | val buffer = ArrayBuffer[FoldingDescriptor]() 21 | val iterator = depthFirst(node) 22 | while (iterator.hasNext) { 23 | val n = iterator.next() 24 | if (foldableTypes.contains(n.getElementType) && n.getTextLength > 0) { 25 | buffer += new FoldingDescriptor(n, n.getTextRange) 26 | } 27 | } 28 | buffer.toArray 29 | } 30 | 31 | def isCollapsedByDefault(node: ASTNode) = 32 | false 33 | 34 | def getPlaceholderText(node: ASTNode): String = node.getElementType match { 35 | case Object => "{...}" 36 | case Array => "[...]" 37 | case MultilineString => "\"\"\"...\"\"\"" 38 | } 39 | 40 | private def depthFirst(root: ASTNode): Iterator[ASTNode] = new DepthFirstIterator(root) 41 | 42 | private class DepthFirstIterator(node: ASTNode) extends Iterator[ASTNode] { 43 | private val stack = mutable.Stack[ASTNode](node) 44 | 45 | def hasNext: Boolean = stack.nonEmpty 46 | 47 | def next(): ASTNode = { 48 | val element = stack.pop() 49 | pushChildren(element) 50 | element 51 | } 52 | 53 | def pushChildren(element: ASTNode): Unit = { 54 | var child = element.getLastChildNode 55 | while (child != null) { 56 | stack.push(child) 57 | child = child.getTreePrev 58 | } 59 | } 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/navigation/HoconReadWriteAccessDetector.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package navigation 3 | 4 | import com.intellij.codeInsight.highlighting.ReadWriteAccessDetector 5 | import com.intellij.codeInsight.highlighting.ReadWriteAccessDetector.Access 6 | import com.intellij.psi.{PsiElement, PsiReference} 7 | import org.jetbrains.plugins.hocon.psi.{HFieldKey, HKey} 8 | 9 | class HoconReadWriteAccessDetector extends ReadWriteAccessDetector { 10 | def isReadWriteAccessible(element: PsiElement): Boolean = element match { 11 | case _: HKey => true 12 | case _ => false 13 | } 14 | 15 | def isDeclarationWriteAccess(element: PsiElement): Boolean = false 16 | 17 | def getReferenceAccess(referencedElement: PsiElement, reference: PsiReference): Access = 18 | getExpressionAccess(reference.getElement) 19 | 20 | def getExpressionAccess(expression: PsiElement): Access = expression match { 21 | case _: HFieldKey => Access.Write 22 | case _ => Access.Read 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/parser/HoconElementSets.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package parser 3 | 4 | import com.intellij.psi.TokenType 5 | 6 | object HoconElementSets { 7 | 8 | import org.jetbrains.plugins.hocon.parser.HoconElementType._ 9 | 10 | final val KeyedField = 11 | PrefixedField | ValuedField 12 | final val Literal = 13 | Null | Boolean | Number | StringValue 14 | final val Value = 15 | Literal | Object | Array | Substitution | Concatenation 16 | final val ForcedLeafBlock = 17 | FieldKey | SubstitutionKey | Path | UnquotedString | Number | Null | Boolean | TokenType.ERROR_ELEMENT 18 | } 19 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/psi/HoconPsiElementFactory.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package psi 3 | 4 | import com.intellij.psi.{PsiFileFactory, PsiManager} 5 | import org.jetbrains.plugins.hocon.lang.HoconFileType 6 | 7 | import scala.reflect.ClassTag 8 | 9 | object HoconPsiElementFactory { 10 | private val Dummy = "dummy." 11 | 12 | private def createElement[T <: HoconPsiElement : ClassTag](manager: PsiManager, text: String, offset: Int): Option[T] = { 13 | val element = PsiFileFactory.getInstance(manager.getProject) 14 | .createFileFromText(Dummy + HoconFileType.DefaultExtension, new HoconFileType, text).findElementAt(offset) 15 | Iterator.iterate(element)(_.getParent).takeWhile(_ != null).collectFirst({ case t: T => t }) 16 | } 17 | 18 | def createStringValue(contents: String, manager: PsiManager): HStringValue = 19 | createElement[HStringValue](manager, s"__k = $contents", 6).orNull 20 | 21 | def createKeyPart(contents: String, manager: PsiManager): HKeyPart = 22 | createElement[HKeyPart](manager, s"$contents = null", 0).orNull 23 | 24 | def createIncludeTarget(contents: String, manager: PsiManager): HIncludeTarget = 25 | createElement[HIncludeTarget](manager, s"include $contents", 8).orNull 26 | 27 | def createFieldKey(contents: String, manager: PsiManager): HFieldKey = 28 | createElement[HFieldKey](manager, s"$contents = null", 0).orNull 29 | 30 | def createSubstitutionKey(contents: String, manager: PsiManager): HSubstitutionKey = 31 | createElement[HSubstitutionKey](manager, s"__k = $${$contents}}", 8).orNull 32 | 33 | def createPath(path: String, manager: PsiManager): HPath = 34 | createElement[HSubstitution](manager, s"__k = $${$path}", 8).flatMap(_.path).orNull 35 | } 36 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/ref/HStringJavaClassReferenceProvider.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package ref 3 | 4 | import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider 5 | import com.intellij.psi.{PsiElement, PsiReference} 6 | import org.jetbrains.plugins.hocon.psi.HString 7 | import org.jetbrains.plugins.hocon.settings.HoconProjectSettings 8 | 9 | class HStringJavaClassReferenceProvider extends JavaClassReferenceProvider { 10 | 11 | import org.jetbrains.plugins.hocon.lexer.HoconTokenType._ 12 | import org.jetbrains.plugins.hocon.parser.HoconElementType._ 13 | 14 | setSoft(true) 15 | 16 | private def isEligible(element: HString) = { 17 | val settings = HoconProjectSettings.getInstance(element.getProject) 18 | (element.getNode.getElementType, element.stringType) match { 19 | case (StringValue, UnquotedString) => settings.classReferencesOnUnquotedStrings 20 | case (StringValue | KeyPart, QuotedString) => settings.classReferencesOnQuotedStrings 21 | case _ => false 22 | } 23 | } 24 | 25 | override def getReferencesByString(str: String, position: PsiElement, offsetInPosition: Int): Array[PsiReference] = position match { 26 | case hstr: HString if isEligible(hstr) => 27 | super.getReferencesByString(str, position, offsetInPosition) 28 | case _ => 29 | PsiReference.EMPTY_ARRAY 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/ref/HoconIncludeResolutionInspection.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package ref 3 | 4 | import com.intellij.codeInspection.{LocalInspectionTool, ProblemHighlightType, ProblemsHolder} 5 | import com.intellij.psi.{PsiElement, PsiElementVisitor} 6 | import org.jetbrains.plugins.hocon.psi.HIncludeTarget 7 | 8 | abstract class AbstractHoconIncludeResolutionInspection(forRequired: Boolean) extends LocalInspectionTool { 9 | override def buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor = 10 | new PsiElementVisitor { 11 | override def visitElement(element: PsiElement): Unit = element match { 12 | case hit: HIncludeTarget if hit.parent.parent.required == forRequired => 13 | hit.getFileReferences.foreach { ref => 14 | if (!ref.isSoft && ref.multiResolve(false).isEmpty) { 15 | holder.registerProblem(ref, ProblemsHolder.unresolvedReferenceMessage(ref), 16 | ProblemHighlightType.LIKE_UNKNOWN_SYMBOL) 17 | } 18 | } 19 | case _ => 20 | super.visitElement(element) 21 | } 22 | } 23 | } 24 | 25 | class HoconIncludeResolutionInspection extends AbstractHoconIncludeResolutionInspection(false) 26 | class HoconRequiredIncludeResolutionInspection extends AbstractHoconIncludeResolutionInspection(true) -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/ref/HoconJavaReferenceContributor.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package ref 3 | 4 | import com.intellij.patterns.{PlatformPatterns, PsiElementPattern} 5 | import com.intellij.psi.{PsiElement, PsiLiteral, PsiReferenceContributor, PsiReferenceRegistrar} 6 | import org.jetbrains.plugins.hocon.psi.HString 7 | 8 | import scala.reflect.{ClassTag, classTag} 9 | 10 | class HoconJavaReferenceContributor extends PsiReferenceContributor { 11 | private def pattern[T <: PsiElement : ClassTag]: PsiElementPattern.Capture[T] = 12 | PlatformPatterns.psiElement(classTag[T].runtimeClass.asInstanceOf[Class[T]]) 13 | 14 | override def registerReferenceProviders(registrar: PsiReferenceRegistrar): Unit = { 15 | registrar.registerReferenceProvider(pattern[HString], new HStringJavaClassReferenceProvider) 16 | registrar.registerReferenceProvider(pattern[PsiLiteral], new HoconPropertiesReferenceProvider) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/ref/HoconPropertyLookupElement.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package ref 3 | 4 | import com.intellij.codeInsight.lookup.{LookupElement, LookupElementPresentation} 5 | import com.intellij.psi.PsiElement 6 | import org.jetbrains.plugins.hocon.semantics._ 7 | 8 | class HoconPropertyLookupElement(resField: ResolvedField) extends LookupElement { 9 | def getLookupString: String = resField.field.key.fold("")(_.getText) 10 | 11 | override def renderElement(presentation: LookupElementPresentation): Unit = { 12 | super.renderElement(presentation) 13 | presentation.setIcon(PropertyIcon) 14 | val resolvedValue = resField.resolveValue 15 | if (resolvedValue != ObjectValue) { 16 | presentation.setTailText(resolvedValue.valueHint) 17 | } else { 18 | presentation.setItemTextBold(true) 19 | } 20 | presentation.setTypeText(resolvedValue.typeHint) 21 | } 22 | 23 | override def getObject: ResolvedField = resField 24 | 25 | override def getPsiElement: PsiElement = resField.hkey 26 | 27 | def repr: String = { 28 | val resValue = resField.resolveValue 29 | s"$getLookupString (${resValue.typeHint})${resValue.valueHint}" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/ref/HoconQualifiedNameProvider.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package ref 3 | 4 | import com.intellij.ide.actions.QualifiedNameProvider 5 | import com.intellij.openapi.project.Project 6 | import com.intellij.psi.PsiElement 7 | import org.jetbrains.plugins.hocon.psi.HKey 8 | 9 | /** 10 | * @author ghik 11 | */ 12 | class HoconQualifiedNameProvider extends QualifiedNameProvider { 13 | def adjustElementToCopy(element: PsiElement): PsiElement = element 14 | 15 | def getQualifiedName(element: PsiElement): String = element match { 16 | case key: HKey => key.fullPathText.orNull 17 | case _ => null 18 | } 19 | 20 | def qualifiedNameToElement(fqn: String, project: Project): PsiElement = null 21 | } 22 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/ref/HoconReferenceContributor.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package ref 3 | 4 | import com.intellij.patterns.{PlatformPatterns, PsiElementPattern} 5 | import com.intellij.psi.{PsiElement, PsiReferenceContributor, PsiReferenceRegistrar} 6 | import org.jetbrains.plugins.hocon.psi.{HIncludeTarget, HStringValue} 7 | 8 | import scala.reflect.{ClassTag, classTag} 9 | 10 | class HoconReferenceContributor extends PsiReferenceContributor { 11 | private def pattern[T <: PsiElement : ClassTag]: PsiElementPattern.Capture[T] = 12 | PlatformPatterns.psiElement(classTag[T].runtimeClass.asInstanceOf[Class[T]]) 13 | 14 | def registerReferenceProviders(registrar: PsiReferenceRegistrar): Unit = { 15 | registrar.registerReferenceProvider(pattern[HIncludeTarget], new IncludedFileReferenceProvider) 16 | registrar.registerReferenceProvider(pattern[HStringValue], new HoconPropertiesReferenceProvider) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/ref/IncludedFileReferenceProvider.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package ref 3 | 4 | import com.intellij.psi.{PsiElement, PsiReference, PsiReferenceProvider} 5 | import com.intellij.util.ProcessingContext 6 | import org.jetbrains.plugins.hocon.psi.HIncludeTarget 7 | 8 | class IncludedFileReferenceProvider extends PsiReferenceProvider { 9 | def getReferencesByElement(element: PsiElement, context: ProcessingContext): Array[PsiReference] = element match { 10 | case includeTarget: HIncludeTarget => 11 | includeTarget.getFileReferences.asInstanceOf[Array[PsiReference]] 12 | case _ => PsiReference.EMPTY_ARRAY 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/ref/PackageDirsEnumerator.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package ref 3 | 4 | import com.intellij.openapi.extensions.ExtensionPointName 5 | import com.intellij.openapi.project.Project 6 | import com.intellij.openapi.roots.PackageIndex 7 | import com.intellij.openapi.vfs.VirtualFile 8 | import com.intellij.psi.search.GlobalSearchScope 9 | import com.intellij.psi.{PsiFileSystemItem, PsiManager} 10 | 11 | object PackageDirsEnumerator { 12 | final val EpName: ExtensionPointName[PackageDirsEnumerator] = 13 | ExtensionPointName.create("org.jetbrains.plugins.hocon.packageDirsEnumerator") 14 | 15 | def packageNameByDirectory(project: Project, dir: VirtualFile): Option[String] = 16 | EpName.getExtensionList.iterator.asScala 17 | .flatMap(_.packageNameByDirectory(project, dir)).nextOption() 18 | 19 | def classpathPackageDirs(project: Project, scope: GlobalSearchScope, pkgName: String): List[PsiFileSystemItem] = 20 | EpName.getExtensionList.iterator.asScala 21 | .flatMap(_.classpathPackageDirs(project, scope, pkgName)).toList 22 | } 23 | abstract class PackageDirsEnumerator { 24 | def packageNameByDirectory(project: Project, dir: VirtualFile): Option[String] 25 | def classpathPackageDirs(project: Project, scope: GlobalSearchScope, pkgName: String): List[PsiFileSystemItem] 26 | } 27 | 28 | final class JavaPackageDirsEnumerator extends PackageDirsEnumerator { 29 | def classpathPackageDirs(project: Project, scope: GlobalSearchScope, pkgName: String): List[PsiFileSystemItem] = { 30 | val psiManager = PsiManager.getInstance(project) 31 | PackageIndex.getInstance(project).getDirectoriesByPackageName(pkgName, false).iterator 32 | .filter(scope.contains).flatMap(dir => Option(psiManager.findDirectory(dir))) 33 | .toList 34 | } 35 | 36 | def packageNameByDirectory(project: Project, dir: VirtualFile): Option[String] = 37 | PackageIndex.getInstance(project).getPackageNameByDirectory(dir).opt 38 | } 39 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/semantics/ConfigValue.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package semantics 3 | 4 | import org.jetbrains.plugins.hocon.psi.{HNumber, HStringValue} 5 | 6 | sealed abstract class ConfigValue { 7 | def concat(other: ConfigValue): ConfigValue = (this, other) match { 8 | case (InvalidValue, _) | (_, InvalidValue) => InvalidValue 9 | case (_, NoValue) => this 10 | case (NoValue, _) => other 11 | case (SimpleValue(ltext, concatWsLeft), SimpleValue(rtext, concatWsRight)) => 12 | StringValue(ltext + rtext, concatWsLeft && concatWsRight) 13 | case (ArrayValue, ArrayValue) => ArrayValue 14 | case (ObjectValue, ObjectValue) => ObjectValue 15 | case (ArrayValue | ObjectValue, StringValue(_, true)) => this 16 | case (StringValue(_, true), ArrayValue | ObjectValue) => other 17 | case _ => InvalidValue 18 | } 19 | 20 | def typeHint: String = this match { 21 | case NullValue => "null" 22 | case _: BooleanValue => "boolean" 23 | case _: NumberValue => "number" 24 | case _: StringValue => "string" 25 | case ArrayValue => "array" 26 | case ObjectValue => "object" 27 | case _ => "" 28 | } 29 | 30 | def valueHint: String = this match { 31 | case SimpleValue(value, _) => s" = ${HStringValue.quoteIfNecessary(value)}" 32 | case ArrayValue => " = [...]" 33 | case ObjectValue => " = {...}" 34 | case _ => "" 35 | } 36 | } 37 | sealed abstract class SimpleValue(val text: String) extends ConfigValue 38 | object SimpleValue { 39 | def unapply(sv: SimpleValue): Some[(String, Boolean)] = 40 | Some((sv.text, sv match { 41 | case StringValue(_, concatWhitespace) => concatWhitespace 42 | case _ => false 43 | })) 44 | } 45 | final case class StringValue(value: String, concatWhitespace: Boolean = false) extends SimpleValue(value) { 46 | def quotedIfNecessary: String = HStringValue.quoteIfNecessary(value) 47 | } 48 | // keeping numeric value as String to preserve exact representation 49 | final case class NumberValue(value: String) extends SimpleValue(value) { 50 | def number: Number = HNumber.parse(value) 51 | } 52 | final case class BooleanValue(value: Boolean) extends SimpleValue(value.toString) 53 | case object NullValue extends SimpleValue("null") 54 | case object ArrayValue extends ConfigValue 55 | case object ObjectValue extends ConfigValue 56 | case object NoValue extends ConfigValue 57 | case object InvalidValue extends ConfigValue 58 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/settings/HoconProjectSettings.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package settings 3 | 4 | import com.intellij.openapi.components.State.NameGetter 5 | import com.intellij.openapi.components._ 6 | import com.intellij.openapi.project.Project 7 | import com.intellij.util.xmlb.XmlSerializerUtil 8 | 9 | import scala.beans.BeanProperty 10 | 11 | @State( 12 | name = "HoconProjectSettings", 13 | storages = Array( 14 | new Storage(StoragePathMacros.WORKSPACE_FILE), 15 | new Storage("hocon_settings.xml") 16 | ), 17 | presentableName = classOf[HoconSettingsNameGetter], 18 | additionalExportDirectory = "hocon_project_settings.xml", 19 | ) 20 | class HoconProjectSettings extends PersistentStateComponent[HoconProjectSettings] { 21 | def getState: HoconProjectSettings = this 22 | 23 | def loadState(state: HoconProjectSettings): Unit = 24 | XmlSerializerUtil.copyBean(state, this) 25 | 26 | @BeanProperty var classReferencesOnUnquotedStrings = true 27 | @BeanProperty var classReferencesOnQuotedStrings = true 28 | @BeanProperty var propertyReferencesOnStrings = true 29 | @BeanProperty var searchInGotoSymbol = false 30 | } 31 | 32 | object HoconProjectSettings { 33 | def getInstance(project: Project): HoconProjectSettings = 34 | project.getService(classOf[HoconProjectSettings]) 35 | } 36 | 37 | class HoconSettingsNameGetter extends NameGetter { 38 | def get(): String = "HOCON Project Settings" 39 | } 40 | -------------------------------------------------------------------------------- /src/org/jetbrains/plugins/hocon/settings/HoconProjectSettingsConfigurable.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package settings 3 | 4 | import com.intellij.openapi.options.Configurable 5 | import com.intellij.openapi.project.Project 6 | import javax.swing.JComponent 7 | 8 | class HoconProjectSettingsConfigurable(project: Project) extends Configurable { 9 | private var panel = new HoconProjectSettingsPanel(project) 10 | 11 | override def getDisplayName = "HOCON" 12 | 13 | override def isModified: Boolean = panel.isModified 14 | 15 | override def createComponent(): JComponent = panel.getMainComponent 16 | 17 | override def disposeUIResources(): Unit = { 18 | panel = null 19 | } 20 | 21 | override def apply(): Unit = panel.apply() 22 | 23 | override def reset(): Unit = panel.loadSettings() 24 | } 25 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/HoconActionTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | 3 | import com.intellij.ide.DataManager 4 | import com.intellij.openapi.actionSystem._ 5 | import com.intellij.openapi.editor.Editor 6 | import com.intellij.openapi.fileEditor.{FileEditorManager, OpenFileDescriptor} 7 | import com.intellij.psi.PsiFile 8 | import com.intellij.testFramework.TestActionEvent 9 | import org.junit.Assert.assertNotNull 10 | 11 | /** 12 | * @author ghik 13 | */ 14 | abstract class HoconActionTest protected(protected val actionId: String, subPath: String) 15 | extends HoconFileSetTestCase(s"actions/$subPath") { 16 | 17 | // Code based on AbstractEnterActionTestBase 18 | 19 | import HoconActionTest._ 20 | import HoconFileSetTestCase._ 21 | 22 | override protected def transform(data: Seq[String]): String = { 23 | val (fileText, offset) = extractCaret(data.head) 24 | val psiFile = createPseudoPhysicalHoconFile(fileText) 25 | 26 | val editorManager = FileEditorManager.getInstance(myProject) 27 | val editor: Editor = editorManager.openTextEditor( 28 | new OpenFileDescriptor(myProject, psiFile.getVirtualFile, 0), false) 29 | assertNotNull(editor) 30 | editor.getCaretModel.moveToOffset(offset) 31 | 32 | try { 33 | executeAction(mockDataContext(psiFile, editor), editor) 34 | extractResult(psiFile, editor) 35 | } finally { 36 | editorManager.closeFile(psiFile.getVirtualFile) 37 | } 38 | } 39 | 40 | protected def executeAction(dataContext: DataContext, editor: Editor): Unit = { 41 | val action = ActionManager.getInstance.getAction(actionId) 42 | val actionEvent = TestActionEvent.createTestEvent(action, dataContext) 43 | 44 | actionEvent.getPresentation match { 45 | case presentation if presentation.isEnabled && presentation.isVisible => 46 | action.actionPerformed(actionEvent) 47 | case _ => 48 | } 49 | } 50 | 51 | protected def extractResult(file: PsiFile, editor: Editor): String 52 | } 53 | 54 | object HoconActionTest { 55 | 56 | private def mockDataContext(file: PsiFile, editor: Editor) = { 57 | val parentContext = DataManager.getInstance().getDataContext(editor.getComponent) 58 | CustomizedDataContext.withSnapshot(parentContext, (sink: DataSink) => { 59 | sink.set(CommonDataKeys.PROJECT, file.getProject) 60 | sink.set(CommonDataKeys.EDITOR, editor) 61 | sink.set(CommonDataKeys.PSI_FILE, file) 62 | }) 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/HoconSingleModuleTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | 3 | import com.intellij.openapi.roots.ModuleRootManager 4 | import com.intellij.testFramework.PsiTestUtil.removeContentEntry 5 | import com.intellij.testFramework.{IndexingTestUtil, LightPlatformCodeInsightTestCase} 6 | 7 | abstract class HoconSingleModuleTest extends LightPlatformCodeInsightTestCase with HoconTestUtils { 8 | final def project = getProject 9 | final def module = getModule 10 | final def psiManager = getPsiManager 11 | 12 | override def setUp(): Unit = { 13 | super.setUp() 14 | 15 | val rootModel = ModuleRootManager.getInstance(module).getModifiableModel 16 | rootModel.addContentEntry(contentRoot).addSourceFolder(contentRoot, false) 17 | 18 | inWriteAction { 19 | rootModel.commit() 20 | } 21 | 22 | IndexingTestUtil.waitUntilIndexesAreReady(project) 23 | } 24 | 25 | override def tearDown(): Unit = { 26 | removeContentEntry(module, contentRoot) 27 | super.tearDown() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/HoconTestUtils.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | 3 | import java.io.File 4 | import com.intellij.openapi.application.ApplicationManager 5 | import com.intellij.openapi.project.Project 6 | import com.intellij.openapi.util.Computable 7 | import com.intellij.openapi.vfs.{LocalFileSystem, VirtualFile} 8 | import com.intellij.psi.{PsiFile, PsiManager} 9 | import org.jetbrains.plugins.hocon.psi.HoconPsiFile 10 | 11 | import scala.annotation.{nowarn, tailrec} 12 | 13 | trait HoconTestUtils { 14 | def testdataPath: String = HoconTestUtils.TestdataPath 15 | 16 | def rootPath: String 17 | 18 | def pathOf(file: PsiFile): String = 19 | file.getVirtualFile.getPath.stripPrefix(contentRoot.getPath).stripPrefix("/") 20 | 21 | lazy val contentRoot: VirtualFile = { 22 | val lfs = LocalFileSystem.getInstance() 23 | lfs.refresh(false) 24 | lfs.findFileByPath(rootPath).opt 25 | .getOrElse(throw new IllegalArgumentException(s"root path not found: $rootPath")) 26 | } 27 | 28 | def findVirtualFile(path: String): VirtualFile = 29 | contentRoot.findFileByRelativePath(path).opt 30 | .getOrElse(throw new IllegalArgumentException(s"file not found: $path")) 31 | 32 | def findFile(path: String, project: Project): PsiFile = 33 | PsiManager.getInstance(project).findFile(findVirtualFile(path)) 34 | 35 | def findHoconFile(path: String, project: Project): HoconPsiFile = 36 | findFile(path, project) match { 37 | case file: HoconPsiFile => file 38 | case _ => throw new IllegalArgumentException(s"not a HOCON file: $path") 39 | } 40 | 41 | def inWriteAction[T](body: => T): T = 42 | ApplicationManager.getApplication match { 43 | case application if application.isWriteAccessAllowed => body 44 | case application => 45 | @nowarn("msg=deprecated") 46 | val computable: Computable[T] = () => body 47 | application.runWriteAction(computable) 48 | } 49 | 50 | } 51 | object HoconTestUtils { 52 | final lazy val TestdataPath = { 53 | @tailrec def find(dir: File): File = 54 | if (dir == null) 55 | throw new RuntimeException("testdata dir not found") 56 | else { 57 | val td = new File(dir, "testdata") 58 | if (td.exists()) td 59 | else find(dir.getParentFile) 60 | } 61 | find(new File(".")).getAbsolutePath 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/TestSuiteCompanion.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | 3 | import scala.reflect.{ClassTag, classTag} 4 | 5 | abstract class TestSuiteCompanion[T: ClassTag] { 6 | def suite: T = 7 | classTag[T].runtimeClass.asInstanceOf[Class[T]].getDeclaredConstructor().newInstance() 8 | } 9 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/completion/HoconCompletionTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package completion 3 | 4 | import com.intellij.codeInsight.completion.CompletionType 5 | import com.intellij.testFramework.fixtures.BasePlatformTestCase 6 | import org.jetbrains.plugins.hocon.ref.HoconPropertyLookupElement 7 | import org.junit.Assert.assertEquals 8 | 9 | class HoconCompletionTest extends BasePlatformTestCase { 10 | 11 | override def getTestDataPath: String = "testdata/completion" 12 | 13 | def testToplevel(): Unit = testCompletion( 14 | "moar (number) = 5", 15 | "top (object) = {...}", 16 | ) 17 | 18 | def testInner(): Unit = testCompletion( 19 | "arr (array) = [...]", 20 | "boo (boolean) = true", 21 | "nul (null) = null", 22 | "num (number) = 2", 23 | "obj (object) = {...}", 24 | "str (string) = kek", 25 | ) 26 | 27 | def testInner2(): Unit = testInner() 28 | 29 | def testToplevelSub(): Unit = testCompletion( 30 | "value ()", 31 | "moar (number) = 5", 32 | "top (object) = {...}", 33 | ) 34 | 35 | def testInnerSub(): Unit = testInner() 36 | 37 | private def testCompletion(expected: String*): Unit = { 38 | myFixture.configureByFiles(s"${getTestName(true)}.conf", "included.conf") 39 | val lookups = myFixture.complete(CompletionType.BASIC) map { 40 | case hple: HoconPropertyLookupElement => hple.repr 41 | } 42 | assertEquals(lookups.toSeq, expected) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/formatting/HoconFormatterTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package formatting 3 | 4 | import com.intellij.application.options.CodeStyle 5 | import com.intellij.openapi.util.JDOMUtil 6 | import com.intellij.psi.codeStyle.CodeStyleManager 7 | import org.junit.runner.RunWith 8 | import org.junit.runners.AllTests 9 | 10 | @RunWith(classOf[AllTests]) 11 | class HoconFormatterTest extends HoconFileSetTestCase("formatter") { 12 | 13 | override protected def transform(data: Seq[String]): String = { 14 | val Seq(settingsXml, input) = data 15 | 16 | val settings = CodeStyle.getSettings(myProject) 17 | settings.readExternal(JDOMUtil.load(settingsXml)) 18 | 19 | val psiFile = createPseudoPhysicalHoconFile(input) 20 | 21 | inWriteCommandAction { 22 | val TextRange(start, end) = psiFile.getTextRange 23 | CodeStyleManager.getInstance(myProject).reformatText(psiFile, start, end) 24 | } 25 | 26 | psiFile.getText 27 | } 28 | } 29 | 30 | object HoconFormatterTest extends TestSuiteCompanion[HoconFormatterTest] 31 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/includes/HoconIncludeResolutionTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package includes 3 | 4 | import com.intellij.openapi.project.Project 5 | import com.intellij.psi.PsiFile 6 | import org.jetbrains.plugins.hocon.lexer.HoconTokenType 7 | import org.jetbrains.plugins.hocon.psi.HIncludeTarget 8 | import org.jetbrains.plugins.hocon.ref.IncludedFileReference 9 | import org.junit.Assert.{assertEquals, assertTrue} 10 | 11 | /** 12 | * @author ghik 13 | */ 14 | trait HoconIncludeResolutionTest extends HoconTestUtils { 15 | protected def checkFile(path: String, project: Project): Unit = { 16 | val psiFile = findHoconFile(path, project) 17 | 18 | psiFile.depthFirst.collectOnly[HIncludeTarget].foreach { target => 19 | val hincluded = target.parent.parent 20 | val prevComments = hincluded.parent.nonWhitespaceChildren 21 | .takeWhile(e => e.getNode.getElementType == HoconTokenType.HashComment) 22 | .toVector 23 | 24 | val references = target.getFileReferences 25 | 26 | if (prevComments.nonEmpty) { 27 | assertTrue("No references in " + hincluded.getText, references.nonEmpty) 28 | val resolveResults = references.last.multiResolve(false) 29 | resolveResults.sliding(2).foreach { 30 | case Array(rr1, rr2) => 31 | assertTrue(IncludedFileReference.ResolveResultOrdering.lteq(rr1, rr2)) 32 | case _ => 33 | } 34 | 35 | val expectedFiles = prevComments.flatMap(_.getText.stripPrefix("#").split(',')) 36 | .map(_.trim) 37 | .filter(_.nonEmpty) 38 | .flatMap(path => findVirtualFile(path).opt) 39 | 40 | val actualFiles = resolveResults 41 | .map(_.getElement) 42 | .collect { 43 | case file: PsiFile => file.getVirtualFile 44 | } 45 | 46 | assertEquals(hincluded.getText, expectedFiles.toSet, actualFiles.toSet) 47 | } else { 48 | assertTrue("Expected no references in " + hincluded.getText, references.isEmpty) 49 | } 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/includes/HoconSingleModuleIncludeResolutionTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package includes 3 | 4 | class HoconSingleModuleIncludeResolutionTest extends HoconSingleModuleTest with HoconIncludeResolutionTest { 5 | def rootPath = s"$testdataPath/includes/singlemodule" 6 | 7 | def testIncludesFromTopLevel(): Unit = 8 | checkFile("including.conf") 9 | 10 | def testIncludesFromWithinPackage(): Unit = 11 | checkFile("pkg/including.conf") 12 | 13 | private def checkFile(path: String): Unit = 14 | checkFile(path, getProject) 15 | } 16 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/lexer/HoconLexerTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package lexer 3 | 4 | import org.junit.runner.RunWith 5 | import org.junit.runners.AllTests 6 | 7 | @RunWith(classOf[AllTests]) 8 | class HoconLexerTest extends HoconFileSetTestCase("lexer") { 9 | 10 | def advance(lexer: HoconLexer): HoconLexer = { 11 | lexer.advance() 12 | lexer 13 | } 14 | 15 | override protected def transform(data: Seq[String]): String = { 16 | val fileContents = data.head 17 | val lexer = new HoconLexer 18 | 19 | lexer.start(fileContents) 20 | val tokenIterator = Iterator.iterate(lexer)(advance) 21 | .takeWhile(_.getTokenType != null) 22 | .map(l => (l.getTokenType, fileContents.substring(l.getTokenStart, l.getTokenEnd))) 23 | 24 | tokenIterator.map { 25 | case (token, str) => s"$token {$str}" 26 | }.mkString("\n") 27 | } 28 | } 29 | 30 | object HoconLexerTest extends TestSuiteCompanion[HoconLexerTest] 31 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/manipulators/HoconManipulatorTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package manipulators 3 | 4 | import com.intellij.psi.ElementManipulators 5 | import org.jetbrains.plugins.hocon.psi.{HKey, HString, HoconPsiElement} 6 | import org.junit.runner.RunWith 7 | import org.junit.runners.AllTests 8 | 9 | /** 10 | * @author ghik 11 | */ 12 | abstract class HoconManipulatorTest(clazz: Class[_ <: HoconPsiElement], 13 | name: String) 14 | extends HoconFileSetTestCase("manipulators/" + name) { 15 | 16 | import HoconFileSetTestCase._ 17 | 18 | override protected def transform(data: Seq[String]): String = { 19 | val Seq(inputCaret, newContentInBrackets) = data 20 | val (input, offset) = extractCaret(inputCaret) 21 | val newContent = newContentInBrackets.stripPrefix("[").stripSuffix("]") 22 | 23 | val psiFile = createPseudoPhysicalHoconFile(input) 24 | 25 | inWriteCommandAction { 26 | val element = Iterator.iterate(psiFile.findElementAt(offset))(_.getParent) 27 | .find(clazz.isInstance).get 28 | 29 | val manipulator = ElementManipulators.getManipulator(element) 30 | val range = manipulator.getRangeInElement(element) 31 | manipulator.handleContentChange(element, range, newContent) 32 | } 33 | 34 | psiFile.getText 35 | } 36 | } 37 | 38 | @RunWith(classOf[AllTests]) 39 | class HKeyManipulatorTest extends HoconManipulatorTest(classOf[HKey], "key") 40 | object HKeyManipulatorTest extends TestSuiteCompanion[HKeyManipulatorTest] 41 | 42 | @RunWith(classOf[AllTests]) 43 | class HStringManipulatorTest extends HoconManipulatorTest(classOf[HString], "string") 44 | object HStringManipulatorTest extends TestSuiteCompanion[HStringManipulatorTest] -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/navigation/HoconNavigationTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package navigation 3 | 4 | import com.intellij.openapi.editor.Editor 5 | import com.intellij.psi.PsiFile 6 | import org.junit.runner.RunWith 7 | import org.junit.runners.AllTests 8 | 9 | abstract class HoconNavigationTest(actionId: String, subPath: String) 10 | extends HoconActionTest(actionId, subPath) { 11 | protected def extractResult(file: PsiFile, editor: Editor): String = { 12 | val lp = editor.getCaretModel.getLogicalPosition 13 | s"${lp.line + 1}:${lp.column + 1}" 14 | } 15 | } 16 | 17 | import com.intellij.openapi.actionSystem.IdeActions 18 | 19 | @RunWith(classOf[AllTests]) 20 | class HoconSubstitutionResolutionTest extends HoconNavigationTest(IdeActions.ACTION_GOTO_DECLARATION, "substitution") 21 | object HoconSubstitutionResolutionTest extends TestSuiteCompanion[HoconSubstitutionResolutionTest] 22 | 23 | @RunWith(classOf[AllTests]) 24 | class HoconLiteralPathResolutionTest extends HoconNavigationTest(IdeActions.ACTION_GOTO_DECLARATION, "literalPaths") 25 | object HoconLiteralPathResolutionTest extends TestSuiteCompanion[HoconLiteralPathResolutionTest] 26 | 27 | @RunWith(classOf[AllTests]) 28 | class HoconGoToNextTest extends HoconNavigationTest("HoconGotoNext", "gotoNext") 29 | object HoconGoToNextTest extends TestSuiteCompanion[HoconGoToNextTest] 30 | 31 | @RunWith(classOf[AllTests]) 32 | class HoconGoToPrevTest extends HoconNavigationTest("HoconGotoPrev", "gotoPrev") 33 | object HoconGoToPrevTest extends TestSuiteCompanion[HoconGoToPrevTest] -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/parser/HoconParserTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package parser 3 | 4 | import com.intellij.psi.impl.DebugUtil.psiToString 5 | import org.junit.runner.RunWith 6 | import org.junit.runners.AllTests 7 | 8 | @RunWith(classOf[AllTests]) 9 | class HoconParserTest extends HoconFileSetTestCase("parser") { 10 | 11 | override protected def transform(data: Seq[String]): String = { 12 | val psiFile = createPseudoPhysicalHoconFile(data.head) 13 | psiToString(psiFile, true).replace(":" + psiFile.getName, "") 14 | } 15 | } 16 | 17 | object HoconParserTest extends TestSuiteCompanion[HoconParserTest] 18 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/ref/HoconCopyReferenceTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package ref 3 | 4 | import java.awt.datatransfer.DataFlavor.stringFlavor 5 | 6 | import com.intellij.openapi.actionSystem.IdeActions.ACTION_COPY_REFERENCE 7 | import com.intellij.openapi.editor.Editor 8 | import com.intellij.openapi.ide.CopyPasteManager 9 | import com.intellij.psi.PsiFile 10 | import org.junit.runner.RunWith 11 | import org.junit.runners.AllTests 12 | 13 | @RunWith(classOf[AllTests]) 14 | class HoconCopyReferenceTest extends HoconActionTest(ACTION_COPY_REFERENCE, "copyReference") { 15 | protected def extractResult(file: PsiFile, editor: Editor): String = 16 | CopyPasteManager.getInstance.getContents 17 | .getTransferData(stringFlavor) 18 | .asInstanceOf[String] 19 | } 20 | object HoconCopyReferenceTest extends TestSuiteCompanion[HoconCopyReferenceTest] 21 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/ref/JavaClassReferenceTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package ref 3 | 4 | import com.intellij.psi.PsiClass 5 | import org.junit.Assert.assertEquals 6 | 7 | class JavaClassReferenceTest extends HoconSingleModuleTest { 8 | def rootPath: String = "testdata/javaClassRefs" 9 | 10 | def testReferencesInJavaStringLiteral(): Unit = { 11 | val javaFile = psiManager.findFile(findVirtualFile("pkg/Main.java")) 12 | val cls = javaFile.depthFirst.collectFirst({ case cls: PsiClass => cls }).get 13 | 14 | val hoconFile = psiManager.findFile(findVirtualFile("application.conf")) 15 | val ref = hoconFile.findReferenceAt(11) 16 | 17 | assertEquals(cls, ref.resolve()) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/ref/JavaLiteralHoconReferenceTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package ref 3 | 4 | import com.intellij.psi.PsiLiteralExpression 5 | import org.jetbrains.plugins.hocon.psi.HKey 6 | import org.junit.Assert.assertEquals 7 | 8 | class JavaLiteralHoconReferenceTest extends HoconSingleModuleTest { 9 | def rootPath: String = "testdata/javaLiteralRefs" 10 | 11 | def testReferencesInJavaStringLiteral(): Unit = { 12 | val offsets = List(0, 5, 11) 13 | 14 | val hoconFile = psiManager.findFile(findVirtualFile("application.conf")) 15 | val expectedKeys = offsets.map(off => hoconFile.findElementAt(off).parentOfType[HKey].get) 16 | 17 | val javaFile = psiManager.findFile(findVirtualFile("pkg/Main.java")) 18 | val litOffset = javaFile.depthFirst.collectFirst({ case lit: PsiLiteralExpression => lit }).get.getTextOffset + 1 19 | val resolved = offsets.map(off => javaFile.findReferenceAt(litOffset + off).resolve()) 20 | 21 | assertEquals(expectedKeys, resolved) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/org/jetbrains/plugins/hocon/usages/HoconHighlightUsagesTest.scala: -------------------------------------------------------------------------------- 1 | package org.jetbrains.plugins.hocon 2 | package usages 3 | 4 | import com.intellij.openapi.editor.LogicalPosition 5 | import com.intellij.testFramework.fixtures.BasePlatformTestCase 6 | import org.jetbrains.plugins.hocon.lang.HoconFileType.DefaultExtension 7 | import org.junit.Assert.assertEquals 8 | 9 | /** 10 | * @author ghik 11 | */ 12 | class HoconHighlightUsagesTest extends BasePlatformTestCase { 13 | 14 | override def getTestDataPath: String = "testdata/highlightUsages" 15 | 16 | def testSimple(): Unit = testUsages( 17 | (0, 0, 3), 18 | (1, 0, 3), 19 | (2, 0, 3), 20 | (3, 0, 3), 21 | (6, 0, 3), 22 | (7, 0, 3), 23 | (9, 12, 3) 24 | ) 25 | 26 | def testNested(): Unit = testUsages( 27 | (4, 2, 3), 28 | (7, 4, 3), 29 | (10, 16, 3), 30 | (13, 19, 3), 31 | ) 32 | 33 | def testInArrayElement(): Unit = testUsages( 34 | (6, 3, 3), 35 | (6, 13, 3) 36 | ) 37 | 38 | def testDifferentTexts(): Unit = testUsages( 39 | (0, 0, 3), 40 | (1, 0, 5), 41 | (2, 0, 5), 42 | (3, 0, 9), 43 | (4, 10, 7) 44 | ) 45 | 46 | def testSingle(): Unit = testUsages( 47 | (0, 0, 3) 48 | ) 49 | 50 | private def testUsages(expectedHighlights: (Int, Int, Int)*): Unit = { 51 | val actualHighlights = highlights.map { 52 | case (startOffset, endOffset) => (logicalPositionAt(startOffset), endOffset - startOffset) 53 | }.map { 54 | case (position, length) => (position.line, position.column, length) 55 | } 56 | 57 | assertEquals(expectedHighlights.toSet, actualHighlights.toSet) 58 | } 59 | 60 | private def logicalPositionAt(offset: Int): LogicalPosition = 61 | myFixture.getEditor.offsetToLogicalPosition(offset) 62 | 63 | private def highlights: Seq[(Int, Int)] = { 64 | val testName = s"${getTestName(true)}.$DefaultExtension" 65 | myFixture.testHighlightUsages(testName).toVector.map { highlighter => 66 | (highlighter.getStartOffset, highlighter.getEndOffset) 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /testdata/actions/copyReference/nested.test: -------------------------------------------------------------------------------- 1 | a.b.c { 2 | d.e.f = 42 3 | } 4 | ----- 5 | a.b.c.d.e.f -------------------------------------------------------------------------------- /testdata/actions/copyReference/nestedInArray.test: -------------------------------------------------------------------------------- 1 | a.b.c = [{ 2 | d.e.f = 42 3 | }] 4 | ----- 5 | d.e.f -------------------------------------------------------------------------------- /testdata/actions/copyReference/nestedInner.test: -------------------------------------------------------------------------------- 1 | a.b.c { 2 | d.e.f = 42 3 | } 4 | ----- 5 | a.b.c.d -------------------------------------------------------------------------------- /testdata/actions/copyReference/simple.test: -------------------------------------------------------------------------------- 1 | a.b.c.d.e.f = 42 2 | ----- 3 | a.b.c.d.e.f -------------------------------------------------------------------------------- /testdata/actions/copyReference/simpleInner.test: -------------------------------------------------------------------------------- 1 | a.b.c.d.e.f = 42 2 | ----- 3 | a.b.c.d -------------------------------------------------------------------------------- /testdata/actions/copyReference/substitution.test: -------------------------------------------------------------------------------- 1 | a = ${b.c.d} 2 | ----- 3 | b.c.d -------------------------------------------------------------------------------- /testdata/actions/copyReference/substitutionInner.test: -------------------------------------------------------------------------------- 1 | a = ${b.c.d} 2 | ----- 3 | b -------------------------------------------------------------------------------- /testdata/actions/enter/braces.test: -------------------------------------------------------------------------------- 1 | some.key = {} 2 | ----- 3 | some.key = { 4 | 5 | } -------------------------------------------------------------------------------- /testdata/actions/enter/brackets.test: -------------------------------------------------------------------------------- 1 | some.key = [] 2 | ----- 3 | some.key = [ 4 | 5 | ] -------------------------------------------------------------------------------- /testdata/actions/enter/doubleSlashEnd.test: -------------------------------------------------------------------------------- 1 | // comment 2 | ----- 3 | // comment 4 | -------------------------------------------------------------------------------- /testdata/actions/enter/doubleSlashInside.test: -------------------------------------------------------------------------------- 1 | // slashcomment 2 | ----- 3 | // slash 4 | // comment -------------------------------------------------------------------------------- /testdata/actions/enter/enterBeforeHash.test: -------------------------------------------------------------------------------- 1 | # hash 2 | # hash 3 | ----- 4 | # hash 5 | 6 | # hash -------------------------------------------------------------------------------- /testdata/actions/enter/hashEnd.test: -------------------------------------------------------------------------------- 1 | # hash comment 2 | ----- 3 | # hash comment 4 | -------------------------------------------------------------------------------- /testdata/actions/enter/hashInside.test: -------------------------------------------------------------------------------- 1 | # hashcomment 2 | ----- 3 | # hash 4 | # comment -------------------------------------------------------------------------------- /testdata/actions/enter/nested.test: -------------------------------------------------------------------------------- 1 | some.key { 2 | # hashcomment 3 | } 4 | ----- 5 | some.key { 6 | # hash 7 | # comment 8 | } 9 | -------------------------------------------------------------------------------- /testdata/actions/gotoNext/simple.test: -------------------------------------------------------------------------------- 1 | a = 5 2 | a = 10 3 | ----- 4 | 2:1 -------------------------------------------------------------------------------- /testdata/actions/gotoPrev/simple.test: -------------------------------------------------------------------------------- 1 | a = 5 2 | a = 10 3 | ----- 4 | 1:1 -------------------------------------------------------------------------------- /testdata/actions/joinLines/hashSlash.test: -------------------------------------------------------------------------------- 1 | # something 2 | // else 3 | ----- 4 | # something else -------------------------------------------------------------------------------- /testdata/actions/joinLines/moreSpaces.test: -------------------------------------------------------------------------------- 1 | # something 2 | # else 3 | ----- 4 | # something else -------------------------------------------------------------------------------- /testdata/actions/joinLines/moveCaret.test: -------------------------------------------------------------------------------- 1 | # something 2 | # else 3 | ----- 4 | # something else -------------------------------------------------------------------------------- /testdata/actions/joinLines/nested.test: -------------------------------------------------------------------------------- 1 | some.key { 2 | # something 3 | # else 4 | } 5 | ----- 6 | some.key { 7 | # something else 8 | } -------------------------------------------------------------------------------- /testdata/actions/joinLines/nospace.test: -------------------------------------------------------------------------------- 1 | # something 2 | #else 3 | ----- 4 | # something else -------------------------------------------------------------------------------- /testdata/actions/joinLines/simpleDoubleSlash.test: -------------------------------------------------------------------------------- 1 | // something 2 | // else 3 | ----- 4 | // something else -------------------------------------------------------------------------------- /testdata/actions/joinLines/simpleHash.test: -------------------------------------------------------------------------------- 1 | # something 2 | # else 3 | ----- 4 | # something else -------------------------------------------------------------------------------- /testdata/actions/joinLines/slashHash.test: -------------------------------------------------------------------------------- 1 | // something 2 | # else 3 | ----- 4 | // something else -------------------------------------------------------------------------------- /testdata/actions/literalPaths/simple.test: -------------------------------------------------------------------------------- 1 | this.thing.here = 5 2 | something = this.thing.here 3 | ----- 4 | 1:12 -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/adjacent1.test: -------------------------------------------------------------------------------- 1 | a { 2 | } 3 | b { 4 | } 5 | ----- 6 | b { 7 | } 8 | a { 9 | } 10 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/adjacent10.test: -------------------------------------------------------------------------------- 1 | a.b = 42 2 | a = [{ 3 | }] 4 | ----- 5 | a = [{ 6 | }] 7 | a.b = 42 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/adjacent2.test: -------------------------------------------------------------------------------- 1 | # a doc 2 | a { 3 | } 4 | # b doc 5 | b { 6 | } 7 | ----- 8 | # b doc 9 | b { 10 | } 11 | # a doc 12 | a { 13 | } 14 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/adjacent3.test: -------------------------------------------------------------------------------- 1 | a { 2 | } 3 | 4 | b { 5 | } 6 | ----- 7 | b { 8 | } 9 | 10 | a { 11 | } 12 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/adjacent4.test: -------------------------------------------------------------------------------- 1 | a { 2 | } 3 | 4 | // comment 5 | 6 | b { 7 | } 8 | ----- 9 | b { 10 | } 11 | 12 | // comment 13 | 14 | a { 15 | } 16 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/adjacent5.test: -------------------------------------------------------------------------------- 1 | a { 2 | } 3 | b { 4 | } 5 | ----- 6 | b { 7 | } 8 | a { 9 | } 10 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/adjacent6.test: -------------------------------------------------------------------------------- 1 | c { 2 | a { 3 | } 4 | b { 5 | } 6 | } 7 | ----- 8 | c { 9 | b { 10 | } 11 | a { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/adjacent7.test: -------------------------------------------------------------------------------- 1 | a.b = 42 2 | a { 3 | } 4 | ----- 5 | a { 6 | } 7 | a.b = 42 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/adjacent8.test: -------------------------------------------------------------------------------- 1 | # a doc 2 | include "a" 3 | # b doc 4 | b = c 5 | ----- 6 | # b doc 7 | b = c 8 | # a doc 9 | include "a" -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/adjacent9.test: -------------------------------------------------------------------------------- 1 | a.b = 42 2 | a += { 3 | } 4 | ----- 5 | a += { 6 | } 7 | a.b = 42 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/inout1.test: -------------------------------------------------------------------------------- 1 | a.b = 42 2 | a { 3 | } 4 | ----- 5 | a { 6 | b = 42 7 | } -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/inout10.test: -------------------------------------------------------------------------------- 1 | a { 2 | something.here = 42 3 | b = 42 4 | } 5 | ----- 6 | a { 7 | something.here = 42 8 | } 9 | a.b = 42 -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/inout2.test: -------------------------------------------------------------------------------- 1 | # b doc 2 | a.b = 42 3 | # a doc 4 | a { 5 | } 6 | ----- 7 | # a doc 8 | a { 9 | # b doc 10 | b = 42 11 | } 12 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/inout3.test: -------------------------------------------------------------------------------- 1 | a.b = 42 2 | a = ${whatever.here} { k = v 3 | } 4 | ----- 5 | a = ${whatever.here} { k = v 6 | b = 42 7 | } -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/inout4.test: -------------------------------------------------------------------------------- 1 | a.b.c.d = 42 2 | a.b = { 3 | } 4 | ----- 5 | a.b = { 6 | c.d = 42 7 | } 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/inout5.test: -------------------------------------------------------------------------------- 1 | a.b = 42 2 | a { 3 | something.here = 42 4 | } 5 | ----- 6 | a { 7 | b = 42 8 | something.here = 42 9 | } -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/inout6.test: -------------------------------------------------------------------------------- 1 | a { 2 | b = 42 3 | } 4 | ----- 5 | a { 6 | } 7 | a.b = 42 -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/inout7.test: -------------------------------------------------------------------------------- 1 | # a doc 2 | a { 3 | # b doc 4 | b = 42 5 | } 6 | ----- 7 | # a doc 8 | a { 9 | } 10 | # b doc 11 | a.b = 42 -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/inout8.test: -------------------------------------------------------------------------------- 1 | a = ${whatever.here} { k = v 2 | b = 42 3 | } 4 | ----- 5 | a = ${whatever.here} { k = v 6 | } 7 | a.b = 42 -------------------------------------------------------------------------------- /testdata/actions/moveStatement/both/inout9.test: -------------------------------------------------------------------------------- 1 | a.b = { 2 | c.d = 42 3 | } 4 | ----- 5 | a.b = { 6 | } 7 | a.b.c.d = 42 -------------------------------------------------------------------------------- /testdata/actions/moveStatement/down/descend1.test: -------------------------------------------------------------------------------- 1 | a.b. c.d = 42 2 | a.b = { 3 | } 4 | ----- 5 | a.b = { 6 | "" c.d = 42 7 | } 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/adjacent1.test: -------------------------------------------------------------------------------- 1 | b { 2 | } 3 | a { 4 | } 5 | ----- 6 | a { 7 | } 8 | b { 9 | } -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/adjacent10.test: -------------------------------------------------------------------------------- 1 | a = [{ 2 | }] 3 | a.b = 42 4 | ----- 5 | a.b = 42 6 | a = [{ 7 | }] 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/adjacent2.test: -------------------------------------------------------------------------------- 1 | # b doc 2 | b { 3 | } 4 | # a doc 5 | a { 6 | } 7 | ----- 8 | # a doc 9 | a { 10 | } 11 | # b doc 12 | b { 13 | } 14 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/adjacent3.test: -------------------------------------------------------------------------------- 1 | b { 2 | } 3 | 4 | a { 5 | } 6 | ----- 7 | a { 8 | } 9 | 10 | b { 11 | } 12 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/adjacent4.test: -------------------------------------------------------------------------------- 1 | b { 2 | } 3 | 4 | // comment 5 | 6 | a { 7 | } 8 | ----- 9 | a { 10 | } 11 | 12 | // comment 13 | 14 | b { 15 | } 16 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/adjacent5.test: -------------------------------------------------------------------------------- 1 | b { 2 | } 3 | a { 4 | } 5 | ----- 6 | a { 7 | } 8 | b { 9 | } 10 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/adjacent6.test: -------------------------------------------------------------------------------- 1 | c { 2 | b { 3 | } 4 | a { 5 | } 6 | } 7 | ----- 8 | c { 9 | a { 10 | } 11 | b { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/adjacent7.test: -------------------------------------------------------------------------------- 1 | a { 2 | } 3 | a.b = 42 4 | ----- 5 | a.b = 42 6 | a { 7 | } 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/adjacent8.test: -------------------------------------------------------------------------------- 1 | # b doc 2 | b = c 3 | # a doc 4 | include "a" 5 | ----- 6 | # a doc 7 | include "a" 8 | # b doc 9 | b = c 10 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/adjacent9.test: -------------------------------------------------------------------------------- 1 | a += { 2 | } 3 | a.b = 42 4 | ----- 5 | a.b = 42 6 | a += { 7 | } 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/inout1.test: -------------------------------------------------------------------------------- 1 | a { 2 | b = 42 3 | } 4 | ----- 5 | a.b = 42 6 | a { 7 | } 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/inout10.test: -------------------------------------------------------------------------------- 1 | a { 2 | something.here = 42 3 | } 4 | a.b = 42 5 | ----- 6 | a { 7 | something.here = 42 8 | b = 42 9 | } 10 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/inout2.test: -------------------------------------------------------------------------------- 1 | # a doc 2 | a { 3 | # b doc 4 | b = 42 5 | } 6 | ----- 7 | # b doc 8 | a.b = 42 9 | # a doc 10 | a { 11 | } 12 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/inout3.test: -------------------------------------------------------------------------------- 1 | a = ${whatever.here} { k = v 2 | b = 42 3 | } 4 | ----- 5 | a.b = 42 6 | a = ${whatever.here} { k = v 7 | } 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/inout4.test: -------------------------------------------------------------------------------- 1 | a.b = { 2 | c.d = 42 3 | } 4 | ----- 5 | a.b.c.d = 42 6 | a.b = { 7 | } 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/inout5.test: -------------------------------------------------------------------------------- 1 | a { 2 | b = 42 3 | something.here = 42 4 | } 5 | ----- 6 | a.b = 42 7 | a { 8 | something.here = 42 9 | } 10 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/inout6.test: -------------------------------------------------------------------------------- 1 | a { 2 | } 3 | a.b = 42 4 | ----- 5 | a { 6 | b = 42 7 | } 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/inout7.test: -------------------------------------------------------------------------------- 1 | # a doc 2 | a { 3 | } 4 | # b doc 5 | a.b = 42 6 | ----- 7 | # a doc 8 | a { 9 | # b doc 10 | b = 42 11 | } 12 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/inout8.test: -------------------------------------------------------------------------------- 1 | a = ${whatever.here} { k = v 2 | } 3 | a.b = 42 4 | ----- 5 | a = ${whatever.here} { k = v 6 | b = 42 7 | } 8 | -------------------------------------------------------------------------------- /testdata/actions/moveStatement/up/inout9.test: -------------------------------------------------------------------------------- 1 | a.b = { 2 | } 3 | a.b.c.d = 42 4 | ----- 5 | a.b = { 6 | c.d = 42 7 | } 8 | -------------------------------------------------------------------------------- /testdata/actions/substitution/circular.test: -------------------------------------------------------------------------------- 1 | a.b.c = ${a.b.c} 2 | a.b.c = 10 3 | ----- 4 | 1:16 -------------------------------------------------------------------------------- /testdata/actions/substitution/circular2.test: -------------------------------------------------------------------------------- 1 | a.b.c = ${a.b} 2 | a.b.c = 10 3 | ----- 4 | 1:14 -------------------------------------------------------------------------------- /testdata/actions/substitution/fullPath.test: -------------------------------------------------------------------------------- 1 | a.b.c = 5 2 | a.b.c = 5 3 | d = ${a.b.c} 4 | ----- 5 | 2:5 -------------------------------------------------------------------------------- /testdata/actions/substitution/innerSelfReferential.test: -------------------------------------------------------------------------------- 1 | a.b.c = 5 2 | a.b = ${a.b.c} 3 | a.b.c = 10 4 | ----- 5 | 1:5 -------------------------------------------------------------------------------- /testdata/actions/substitution/invalidPathPrefix.test: -------------------------------------------------------------------------------- 1 | a.b.c = 5 2 | a.b.d = 10 3 | d = ${a.b.c.niema} 4 | ----- 5 | 1:3 -------------------------------------------------------------------------------- /testdata/actions/substitution/pathPrefix.test: -------------------------------------------------------------------------------- 1 | a.b.c = 5 2 | a.b.d = 10 3 | d = ${a.b.c} 4 | ----- 5 | 1:3 -------------------------------------------------------------------------------- /testdata/actions/substitution/selfReferential.test: -------------------------------------------------------------------------------- 1 | a.b.c = 5 2 | a.b.c = ${a.b.c} 3 | a.b.c = 10 4 | ----- 5 | 1:5 -------------------------------------------------------------------------------- /testdata/completion/included.conf: -------------------------------------------------------------------------------- 1 | top { 2 | str = kek 3 | num = 2 4 | boo = true 5 | nul = null 6 | arr = [1, 2, 3] 7 | obj { 8 | sub = foo 9 | } 10 | } 11 | moar = 5 -------------------------------------------------------------------------------- /testdata/completion/inner.conf: -------------------------------------------------------------------------------- 1 | include "included" 2 | top. -------------------------------------------------------------------------------- /testdata/completion/inner2.conf: -------------------------------------------------------------------------------- 1 | include "included" 2 | top { 3 | 4 | } -------------------------------------------------------------------------------- /testdata/completion/innerSub.conf: -------------------------------------------------------------------------------- 1 | include "included" 2 | value = ${top.} -------------------------------------------------------------------------------- /testdata/completion/toplevel.conf: -------------------------------------------------------------------------------- 1 | include "included" 2 | -------------------------------------------------------------------------------- /testdata/completion/toplevelSub.conf: -------------------------------------------------------------------------------- 1 | include "included" 2 | value = ${} -------------------------------------------------------------------------------- /testdata/findUsages/modA/lib/reference.conf: -------------------------------------------------------------------------------- 1 | top { 2 | inner { 3 | prop = 5 4 | } 5 | } 6 | other = ${top.inner.prop} 7 | dyn = top.inner.prop 8 | class = pkg.Main -------------------------------------------------------------------------------- /testdata/findUsages/modA/libsrc/libpkg/LibMain.java: -------------------------------------------------------------------------------- 1 | package libpkg; 2 | 3 | public class LibMain { 4 | public static String PROP = "top.inner.prop" 5 | 6 | public static void main(String[] args) { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /testdata/findUsages/modA/libsrc/reference.conf: -------------------------------------------------------------------------------- 1 | top { 2 | inner { 3 | prop = 5 4 | } 5 | } 6 | other = ${top.inner.prop} 7 | dyn = top.inner.prop 8 | class = pkg.Main -------------------------------------------------------------------------------- /testdata/findUsages/modA/src/application.conf: -------------------------------------------------------------------------------- 1 | top.inner.prop = something 2 | moar = ${top.inner.prop} 3 | dyn = top.inner.prop 4 | class = pkg.Main -------------------------------------------------------------------------------- /testdata/findUsages/modA/src/pkg/Main.java: -------------------------------------------------------------------------------- 1 | package pkg; 2 | 3 | public class Main { 4 | public static String PROP = "top.inner.prop" 5 | 6 | public static void main(String[] args) { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /testdata/findUsages/modB/lib/reference.conf: -------------------------------------------------------------------------------- 1 | top { 2 | inner { 3 | prop = 5 4 | } 5 | } 6 | other = ${top.inner.prop} 7 | dyn = top.inner.prop 8 | class = pkg.Main -------------------------------------------------------------------------------- /testdata/findUsages/modB/libsrc/blibpkg/LibMain.java: -------------------------------------------------------------------------------- 1 | package blibpkg; 2 | 3 | public class LibMain { 4 | public static String PROP = "top.inner.prop" 5 | 6 | public static void main(String[] args) { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /testdata/findUsages/modB/libsrc/reference.conf: -------------------------------------------------------------------------------- 1 | top { 2 | inner { 3 | prop = 5 4 | } 5 | } 6 | other = ${top.inner.prop} 7 | dyn = top.inner.prop 8 | class = pkg.Main -------------------------------------------------------------------------------- /testdata/findUsages/modB/src/application.conf: -------------------------------------------------------------------------------- 1 | top.inner.prop = something 2 | moar = ${top.inner.prop} 3 | dyn = top.inner.prop 4 | class = pkg.Main -------------------------------------------------------------------------------- /testdata/findUsages/modB/src/bpkg/Main.java: -------------------------------------------------------------------------------- 1 | package bpkg; 2 | 3 | public class Main { 4 | public static String PROP = "top.inner.prop" 5 | 6 | public static void main(String[] args) { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /testdata/formatter/arraysAlignWhenMultiline.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | ----- 8 | a = [111, 222, 333] 9 | ----- 10 | a = [111, 11 | 222, 12 | 333] 13 | -------------------------------------------------------------------------------- /testdata/formatter/arraysNewLineAfterLbracket.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | ----- 8 | a = [111, 222, 333] 9 | ----- 10 | a = [ 11 | 111, 12 | 222, 13 | 333] 14 | -------------------------------------------------------------------------------- /testdata/formatter/arraysRbracketOnNextLine.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | ----- 8 | a = [111, 222, 333] 9 | ----- 10 | a = [111, 11 | 222, 12 | 333 13 | ] 14 | -------------------------------------------------------------------------------- /testdata/formatter/arraysWrapAlways.test: -------------------------------------------------------------------------------- 1 | 2 | 7 | ----- 8 | a = [111, 222, 333] 9 | ----- 10 | a = [111, 11 | 222, 12 | 333] 13 | -------------------------------------------------------------------------------- /testdata/formatter/arraysWrapChopDown.test: -------------------------------------------------------------------------------- 1 | 2 | 7 | ----- 8 | a = [111, 222, 333] 9 | ----- 10 | a = [111, 11 | 222, 12 | 333] 13 | -------------------------------------------------------------------------------- /testdata/formatter/arraysWrapIfLong.test: -------------------------------------------------------------------------------- 1 | 2 | 7 | ----- 8 | a = [111, 222, 333] 9 | a = [111, 222] 10 | ----- 11 | a = [111, 222, 12 | 333] 13 | a = [111, 222] 14 | -------------------------------------------------------------------------------- /testdata/formatter/arraysWrapNever.test: -------------------------------------------------------------------------------- 1 | 2 | 7 | ----- 8 | a = [111, 222, 333] 9 | ----- 10 | a = [111, 222, 333] 11 | -------------------------------------------------------------------------------- /testdata/formatter/blankLines.test: -------------------------------------------------------------------------------- 1 | 2 | ----- 3 | 4 | 5 | 6 | include "stuff" 7 | 8 | 9 | 10 | object { 11 | 12 | 13 | key = value 14 | 15 | array = [ 16 | one 17 | 18 | 19 | 20 | two 21 | 22 | 23 | 24 | moar 25 | 26 | 27 | 28 | 29 | ] 30 | 31 | 32 | 33 | } 34 | ----- 35 | include "stuff" 36 | 37 | 38 | object { 39 | 40 | 41 | key = value 42 | 43 | array = [ 44 | one 45 | 46 | 47 | two 48 | 49 | 50 | moar 51 | 52 | 53 | ] 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /testdata/formatter/indentation.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | ----- 9 | obj { 10 | anotherObj { 11 | key = value 12 | anotherKey: anotherValue 13 | longkey = 14 | value 15 | otherkey 16 | = value 17 | anotherkey 18 | = 19 | # blah blah 20 | value 21 | } 22 | a = [ 23 | 1, 2, 3 24 | 4, 5 25 | 6, 7, { 26 | key = value 27 | } 28 | ] 29 | some."long"path.here = { 30 | obj = 20 31 | } 32 | } 33 | ----- 34 | obj { 35 | anotherObj { 36 | key = value 37 | anotherKey: anotherValue 38 | longkey = 39 | value 40 | otherkey 41 | = value 42 | anotherkey 43 | = 44 | # blah blah 45 | value 46 | } 47 | a = [ 48 | 1, 2, 3 49 | 4, 5 50 | 6, 7, { 51 | key = value 52 | } 53 | ] 54 | some."long"path.here = { 55 | obj = 20 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /testdata/formatter/keepCommentsAtFirstColumn.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | ----- 8 | obj { 9 | # hash comment 10 | // double slash comment 11 | } 12 | ----- 13 | obj { 14 | # hash comment 15 | // double slash comment 16 | } 17 | -------------------------------------------------------------------------------- /testdata/formatter/noKeepCommentsAtFirstColumn.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | ----- 8 | obj { 9 | # hash comment 10 | // double slash comment 11 | } 12 | ----- 13 | obj { 14 | # hash comment 15 | // double slash comment 16 | } 17 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceAfterAssignment.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a =b 8 | a = b 9 | a = b 10 | a +=b 11 | a += b 12 | a += b 13 | ----- 14 | a =b 15 | a =b 16 | a =b 17 | a +=b 18 | a +=b 19 | a +=b 20 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceAfterColon.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a:b 8 | a: b 9 | a: b 10 | ----- 11 | a:b 12 | a:b 13 | a:b 14 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceAfterComma.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a = {k = v,k = v,} 8 | a = {k = v, k = v, } 9 | a = {k = v, k = v, } 10 | a = [1,2,] 11 | a = [1, 2, ] 12 | a = [1, 2, ] 13 | ----- 14 | a = {k = v,k = v,} 15 | a = {k = v,k = v,} 16 | a = {k = v,k = v,} 17 | a = [1,2,] 18 | a = [1,2,] 19 | a = [1,2,] 20 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceAfterPathBeforeLbrace.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | obj{} 8 | obj {} 9 | obj {} 10 | ----- 11 | obj{} 12 | obj{} 13 | obj{} 14 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceAfterQmark.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | sub = ${?path} 8 | sub = ${? path} 9 | sub = ${? path} 10 | ----- 11 | sub = ${?path} 12 | sub = ${?path} 13 | sub = ${?path} 14 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceBeforeAssignment.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a= b 8 | a = b 9 | a = b 10 | a+= b 11 | a += b 12 | a += b 13 | ----- 14 | a= b 15 | a= b 16 | a= b 17 | a+= b 18 | a+= b 19 | a+= b 20 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceBeforeColon.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a: b 8 | a : b 9 | a : b 10 | ----- 11 | a: b 12 | a: b 13 | a: b 14 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceBeforeComma.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a = {k = v, k = v,} 8 | a = {k = v , k = v ,} 9 | a = {k = v , k = v ,} 10 | a = [1, 2,] 11 | a = [1 , 2 ,] 12 | a = [1 , 2 ,] 13 | ----- 14 | a = {k = v, k = v,} 15 | a = {k = v, k = v,} 16 | a = {k = v, k = v,} 17 | a = [1, 2,] 18 | a = [1, 2,] 19 | a = [1, 2,] 20 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceWithinBrackets.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a = [42] 8 | a = [ 42] 9 | a = [42 ] 10 | a = [ 42 ] 11 | a = [ 42 ] 12 | a = [ 42 ] 13 | ----- 14 | a = [42] 15 | a = [42] 16 | a = [42] 17 | a = [42] 18 | a = [42] 19 | a = [42] 20 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceWithinIncludeQualifierParens.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | include file("file") 8 | include file( "file") 9 | include file("file" ) 10 | include file( "file" ) 11 | include file( "file" ) 12 | include file( "file" ) 13 | ----- 14 | include file("file") 15 | include file("file") 16 | include file("file") 17 | include file("file") 18 | include file("file") 19 | include file("file") 20 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceWithinObjectBraces.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | obj {a = b} 8 | obj { a = b} 9 | obj {a = b } 10 | obj { a = b } 11 | obj { a = b } 12 | obj { a = b } 13 | ----- 14 | obj {a = b} 15 | obj {a = b} 16 | obj {a = b} 17 | obj {a = b} 18 | obj {a = b} 19 | obj {a = b} 20 | -------------------------------------------------------------------------------- /testdata/formatter/noSpaceWithinSubstitutionBraces.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | sub = ${path.more} 8 | sub = ${ path.more} 9 | sub = ${path.more } 10 | sub = ${ path.more } 11 | sub = ${ path.more } 12 | sub = ${?path.more } 13 | sub = ${? path.more } 14 | sub = ${? path.more } 15 | ----- 16 | sub = ${path.more} 17 | sub = ${path.more} 18 | sub = ${path.more} 19 | sub = ${path.more} 20 | sub = ${path.more} 21 | sub = ${?path.more} 22 | sub = ${?path.more} 23 | sub = ${?path.more} 24 | -------------------------------------------------------------------------------- /testdata/formatter/objectEntriesWrapAlways.test: -------------------------------------------------------------------------------- 1 | 2 | 9 | ----- 10 | a: b 11 | a = b 12 | a += b 13 | include "stuff" 14 | include file("stuff") 15 | ----- 16 | a: 17 | b 18 | a = 19 | b 20 | a += 21 | b 22 | include 23 | "stuff" 24 | include 25 | file("stuff") 26 | -------------------------------------------------------------------------------- /testdata/formatter/objectEntriesWrapIfLong.test: -------------------------------------------------------------------------------- 1 | 2 | 9 | ----- 10 | a: b 11 | seriously long key: seriously long value 12 | a = b 13 | seriously long key = seriously long value 14 | a += b 15 | seriously long key += seriously long value 16 | include "stuff" 17 | include "somethingLongIncluded" 18 | include file("f") 19 | include file("fileWithLongName") 20 | ----- 21 | a: b 22 | seriously long key: 23 | seriously long value 24 | a = b 25 | seriously long key = 26 | seriously long value 27 | a += b 28 | seriously long key += 29 | seriously long value 30 | include "stuff" 31 | include 32 | "somethingLongIncluded" 33 | include file("f") 34 | include 35 | file("fileWithLongName") 36 | -------------------------------------------------------------------------------- /testdata/formatter/objectEntriesWrapNever.test: -------------------------------------------------------------------------------- 1 | 2 | 9 | ----- 10 | a: b 11 | a = b 12 | a += b 13 | include "stuff" 14 | include file("stuff") 15 | ----- 16 | a: b 17 | a = b 18 | a += b 19 | include "stuff" 20 | include file("stuff") 21 | -------------------------------------------------------------------------------- /testdata/formatter/objectFieldsAssignmentOnNextLine.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | ----- 8 | a = b 9 | a += b 10 | ----- 11 | a 12 | = b 13 | a 14 | += b 15 | -------------------------------------------------------------------------------- /testdata/formatter/objectFieldsColonOnNextLine.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | ----- 8 | a: b 9 | ----- 10 | a 11 | : b 12 | -------------------------------------------------------------------------------- /testdata/formatter/objectsAlignWhenMultiline.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | ----- 9 | obj {key = value, key = value, key = value} 10 | ----- 11 | obj {key = value, 12 | key = value, 13 | key = value 14 | } 15 | -------------------------------------------------------------------------------- /testdata/formatter/objectsNoNewLineAfterLbrace.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | ----- 8 | obj {key = value, key = value, key = value} 9 | ----- 10 | obj {key = value, 11 | key = value, 12 | key = value 13 | } 14 | -------------------------------------------------------------------------------- /testdata/formatter/objectsRbraceNotOnNextLine.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | ----- 8 | obj {key = value, key = value, key = value} 9 | ----- 10 | obj { 11 | key = value, 12 | key = value, 13 | key = value} 14 | -------------------------------------------------------------------------------- /testdata/formatter/objectsWrapAlways.test: -------------------------------------------------------------------------------- 1 | 2 | 7 | ----- 8 | obj {key = value, key = value, key = value} 9 | ----- 10 | obj { 11 | key = value, 12 | key = value, 13 | key = value 14 | } 15 | -------------------------------------------------------------------------------- /testdata/formatter/objectsWrapChopDown.test: -------------------------------------------------------------------------------- 1 | 2 | 7 | ----- 8 | obj {key = value, key = value, k = v} 9 | ----- 10 | obj { 11 | key = value, 12 | key = value, 13 | k = v 14 | } 15 | -------------------------------------------------------------------------------- /testdata/formatter/objectsWrapIfLong.test: -------------------------------------------------------------------------------- 1 | 2 | 7 | ----- 8 | obj {key = value, key = value, k = v} 9 | obj {k = v, k = v} 10 | ----- 11 | obj { 12 | key = value, 13 | key = value, k = v 14 | } 15 | obj {k = v, k = v} 16 | -------------------------------------------------------------------------------- /testdata/formatter/objectsWrapNever.test: -------------------------------------------------------------------------------- 1 | 2 | 7 | ----- 8 | obj {key = value, key = value, key = value} 9 | ----- 10 | obj {key = value, key = value, key = value} 11 | -------------------------------------------------------------------------------- /testdata/formatter/spaceAfterAssignment.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a =b 8 | a = b 9 | a = b 10 | a +=b 11 | a += b 12 | a += b 13 | ----- 14 | a = b 15 | a = b 16 | a = b 17 | a += b 18 | a += b 19 | a += b 20 | -------------------------------------------------------------------------------- /testdata/formatter/spaceAfterColon.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a:b 8 | a: b 9 | a: b 10 | ----- 11 | a: b 12 | a: b 13 | a: b 14 | -------------------------------------------------------------------------------- /testdata/formatter/spaceAfterComma.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a = {k = v,k = v,} 8 | a = {k = v, k = v, } 9 | a = {k = v, k = v, } 10 | a = [1,2,] 11 | a = [1, 2, ] 12 | a = [1, 2, ] 13 | ----- 14 | a = {k = v, k = v,} 15 | a = {k = v, k = v,} 16 | a = {k = v, k = v,} 17 | a = [1, 2,] 18 | a = [1, 2,] 19 | a = [1, 2,] 20 | -------------------------------------------------------------------------------- /testdata/formatter/spaceAfterPathBeforeLbrace.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | obj{} 8 | obj {} 9 | obj {} 10 | ----- 11 | obj {} 12 | obj {} 13 | obj {} 14 | -------------------------------------------------------------------------------- /testdata/formatter/spaceAfterQmark.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | sub = ${?path} 8 | sub = ${? path} 9 | sub = ${? path} 10 | ----- 11 | sub = ${? path} 12 | sub = ${? path} 13 | sub = ${? path} 14 | -------------------------------------------------------------------------------- /testdata/formatter/spaceBeforeAssignment.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a= b 8 | a = b 9 | a = b 10 | a+= b 11 | a += b 12 | a += b 13 | ----- 14 | a = b 15 | a = b 16 | a = b 17 | a += b 18 | a += b 19 | a += b 20 | -------------------------------------------------------------------------------- /testdata/formatter/spaceBeforeColon.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a: b 8 | a : b 9 | a : b 10 | ----- 11 | a : b 12 | a : b 13 | a : b 14 | -------------------------------------------------------------------------------- /testdata/formatter/spaceBeforeComma.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a = {k = v, k = v,} 8 | a = {k = v , k = v ,} 9 | a = {k = v , k = v ,} 10 | a = [1, 2,] 11 | a = [1 , 2 ,] 12 | a = [1 , 2 ,] 13 | ----- 14 | a = {k = v , k = v ,} 15 | a = {k = v , k = v ,} 16 | a = {k = v , k = v ,} 17 | a = [1 , 2 ,] 18 | a = [1 , 2 ,] 19 | a = [1 , 2 ,] 20 | -------------------------------------------------------------------------------- /testdata/formatter/spaceWithinBrackets.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | a = [42] 8 | a = [ 42] 9 | a = [42 ] 10 | a = [ 42 ] 11 | a = [ 42 ] 12 | a = [ 42 ] 13 | ----- 14 | a = [ 42 ] 15 | a = [ 42 ] 16 | a = [ 42 ] 17 | a = [ 42 ] 18 | a = [ 42 ] 19 | a = [ 42 ] 20 | -------------------------------------------------------------------------------- /testdata/formatter/spaceWithinIncludeQualifierParens.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | include file("file") 8 | include file( "file") 9 | include file("file" ) 10 | include file( "file" ) 11 | include file( "file" ) 12 | include file( "file" ) 13 | ----- 14 | include file( "file" ) 15 | include file( "file" ) 16 | include file( "file" ) 17 | include file( "file" ) 18 | include file( "file" ) 19 | include file( "file" ) 20 | -------------------------------------------------------------------------------- /testdata/formatter/spaceWithinObjectBraces.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | obj {a = b} 8 | obj { a = b} 9 | obj {a = b } 10 | obj { a = b } 11 | obj { a = b } 12 | obj { a = b } 13 | ----- 14 | obj { a = b } 15 | obj { a = b } 16 | obj { a = b } 17 | obj { a = b } 18 | obj { a = b } 19 | obj { a = b } 20 | -------------------------------------------------------------------------------- /testdata/formatter/spaceWithinSubstitutionBraces.test: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | ----- 7 | sub = ${path.more} 8 | sub = ${ path.more} 9 | sub = ${path.more } 10 | sub = ${ path.more } 11 | sub = ${ path.more } 12 | sub = ${?path.more } 13 | sub = ${? path.more } 14 | sub = ${? path.more } 15 | ----- 16 | sub = ${ path.more } 17 | sub = ${ path.more } 18 | sub = ${ path.more } 19 | sub = ${ path.more } 20 | sub = ${ path.more } 21 | sub = ${?path.more } 22 | sub = ${?path.more } 23 | sub = ${?path.more } 24 | 25 | -------------------------------------------------------------------------------- /testdata/formatter/spacing.test: -------------------------------------------------------------------------------- 1 | 2 | ----- 3 | a=b #comment 4 | a = b 5 | a =b 6 | a= b 7 | a = b //comment 8 | a:b 9 | a : b 10 | a :b 11 | a: b 12 | a : b 13 | a+=b 14 | a += b 15 | a +=b 16 | a+= b 17 | a += b 18 | obj {} 19 | obj = { k = v, k = v ,k = v, k = v , k = v } 20 | obj = {key = value} 21 | arr = [ 1,2, 3 ,4 , 5, ] 22 | sub = ${ path.more } 23 | sub = ${path.more} 24 | sub = ${? path.more } 25 | include file("sth") 26 | include file("sth") 27 | include file( "sth" ) 28 | concat = sth more " more quoted " ${sub} 29 | ----- 30 | a = b #comment 31 | a = b 32 | a = b 33 | a = b 34 | a = b //comment 35 | a: b 36 | a: b 37 | a: b 38 | a: b 39 | a: b 40 | a += b 41 | a += b 42 | a += b 43 | a += b 44 | a += b 45 | obj {} 46 | obj = {k = v, k = v, k = v, k = v, k = v} 47 | obj = {key = value} 48 | arr = [1, 2, 3, 4, 5,] 49 | sub = ${path.more} 50 | sub = ${path.more} 51 | sub = ${?path.more} 52 | include file("sth") 53 | include file("sth") 54 | include file("sth") 55 | concat = sth more " more quoted " ${sub} 56 | -------------------------------------------------------------------------------- /testdata/highlightUsages/differentTexts.conf: -------------------------------------------------------------------------------- 1 | key = 42 2 | "key" = 42 3 | ke"y" = 42 4 | """key""" = 42 5 | subst = ${""key""} 6 | -------------------------------------------------------------------------------- /testdata/highlightUsages/inArrayElement.conf: -------------------------------------------------------------------------------- 1 | key = 42 2 | key.key = 42 3 | key { 4 | key: 42 5 | } 6 | key = [ 7 | {key = 42, key = 42, subst = ${key.key}}, 8 | {key = 42, key = 42}, 9 | ] 10 | key += {key: 42} 11 | -------------------------------------------------------------------------------- /testdata/highlightUsages/nested.conf: -------------------------------------------------------------------------------- 1 | key = string 2 | key = [list] 3 | key = 42 4 | key { 5 | key: 42 6 | } 7 | key.subkey = 42 8 | key.key = 42 9 | otherKey { 10 | key = sthelse 11 | subst = ${key.key} 12 | subst2 = ${other.key} 13 | } 14 | key = ${otherKey} {key = 51} 15 | key += {key: 5} 16 | key = [{key: 5}] -------------------------------------------------------------------------------- /testdata/highlightUsages/simple.conf: -------------------------------------------------------------------------------- 1 | key = string 2 | key = [list] 3 | key = 42 4 | key { 5 | key: 42 6 | } 7 | key.subkey = 42 8 | key.key = 42 9 | otherKey { 10 | subst = ${key} 11 | } 12 | -------------------------------------------------------------------------------- /testdata/highlightUsages/single.conf: -------------------------------------------------------------------------------- 1 | key = 42 2 | other = 42 3 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/lib/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modA/lib/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/lib/including.conf: -------------------------------------------------------------------------------- 1 | # modA/src/included.conf, modA/lib/included.conf 2 | # modB/src/included.conf, modB/lib/included.conf 3 | # modC/src/included.conf, modC/lib/included.conf 4 | include "included" 5 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/libsrc/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modA/libsrc/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/libsrc/including.conf: -------------------------------------------------------------------------------- 1 | # modA/src/included.conf, modA/lib/included.conf 2 | # modB/src/included.conf, modB/lib/included.conf 3 | # modC/src/included.conf, modC/lib/included.conf 4 | include "included" 5 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/src/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modA/src/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/src/including.conf: -------------------------------------------------------------------------------- 1 | # modA/src/included.conf, modA/lib/included.conf 2 | # modB/src/included.conf, modB/lib/included.conf 3 | # modC/src/included.conf, modC/lib/included.conf 4 | include "included" 5 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/testlib/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modA/testlib/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/testlib/including.conf: -------------------------------------------------------------------------------- 1 | # modA/src/included.conf, modA/lib/included.conf, modA/testsrc/included.conf, modA/testlib/included.conf 2 | # modB/src/included.conf, modB/lib/included.conf, modB/testsrc/included.conf, modB/testlib/included.conf 3 | # modC/src/included.conf, modC/lib/included.conf, modC/testsrc/included.conf, modC/testlib/included.conf 4 | include "included" 5 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/testlibsrc/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modA/testlibsrc/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/testlibsrc/including.conf: -------------------------------------------------------------------------------- 1 | # modA/src/included.conf, modA/lib/included.conf, modA/testsrc/included.conf, modA/testlib/included.conf 2 | # modB/src/included.conf, modB/lib/included.conf, modB/testsrc/included.conf, modB/testlib/included.conf 3 | # modC/src/included.conf, modC/lib/included.conf, modC/testsrc/included.conf, modC/testlib/included.conf 4 | include "included" 5 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/testsrc/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modA/testsrc/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modA/testsrc/including.conf: -------------------------------------------------------------------------------- 1 | # modA/src/included.conf, modA/lib/included.conf, modA/testsrc/included.conf, modA/testlib/included.conf 2 | # modB/src/included.conf, modB/lib/included.conf, modB/testsrc/included.conf, modB/testlib/included.conf 3 | # modC/src/included.conf, modC/lib/included.conf, modC/testsrc/included.conf, modC/testlib/included.conf 4 | include "included" 5 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/lib/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modB/lib/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/lib/including.conf: -------------------------------------------------------------------------------- 1 | # modB/src/included.conf, modB/lib/included.conf 2 | # modC/src/included.conf, modC/lib/included.conf 3 | include "included" 4 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/libsrc/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modB/libsrc/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/libsrc/including.conf: -------------------------------------------------------------------------------- 1 | # modB/src/included.conf, modB/lib/included.conf 2 | # modC/src/included.conf, modC/lib/included.conf 3 | include "included" 4 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/src/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modB/src/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/src/including.conf: -------------------------------------------------------------------------------- 1 | # modB/src/included.conf, modB/lib/included.conf 2 | # modC/src/included.conf, modC/lib/included.conf 3 | include "included" 4 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/testlib/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modB/testlib/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/testlib/including.conf: -------------------------------------------------------------------------------- 1 | # modB/src/included.conf, modB/lib/included.conf, modB/testsrc/included.conf, modB/testlib/included.conf 2 | # modC/src/included.conf, modC/lib/included.conf, modC/testsrc/included.conf, modC/testlib/included.conf 3 | include "included" 4 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/testlibsrc/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modB/testlibsrc/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/testlibsrc/including.conf: -------------------------------------------------------------------------------- 1 | # modB/src/included.conf, modB/lib/included.conf, modB/testsrc/included.conf, modB/testlib/included.conf 2 | # modC/src/included.conf, modC/lib/included.conf, modC/testsrc/included.conf, modC/testlib/included.conf 3 | include "included" 4 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/testsrc/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modB/testsrc/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modB/testsrc/including.conf: -------------------------------------------------------------------------------- 1 | # modB/src/included.conf, modB/lib/included.conf, modB/testsrc/included.conf, modB/testlib/included.conf 2 | # modC/src/included.conf, modC/lib/included.conf, modC/testsrc/included.conf, modC/testlib/included.conf 3 | include "included" 4 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/lib/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modC/lib/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/lib/including.conf: -------------------------------------------------------------------------------- 1 | # modC/src/included.conf, modC/lib/included.conf 2 | include "included" 3 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/libsrc/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modC/libsrc/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/libsrc/including.conf: -------------------------------------------------------------------------------- 1 | # modC/src/included.conf, modC/lib/included.conf 2 | include "included" 3 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/other/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modC/other/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/other/including.conf: -------------------------------------------------------------------------------- 1 | # modC/other/included.conf 2 | include "included" 3 | # modC/src/included.conf, modC/lib/included.conf 4 | include classpath("included") 5 | # modC/src/included.conf 6 | include "../src/included" 7 | # 8 | include "src/included" 9 | include "/src/included" 10 | # modC/src/included.conf 11 | include file("src/included") 12 | include file("/src/included") 13 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/src/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modC/src/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/src/including.conf: -------------------------------------------------------------------------------- 1 | # modC/src/included.conf, modC/lib/included.conf 2 | include "included" 3 | # modC/src/included.conf 4 | include file("src/included") -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/testlib/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modC/testlib/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/testlib/including.conf: -------------------------------------------------------------------------------- 1 | # modC/src/included.conf, modC/lib/included.conf, modC/testsrc/included.conf, modC/testlib/included.conf 2 | include "included" 3 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/testlibsrc/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modC/testlibsrc/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/testlibsrc/including.conf: -------------------------------------------------------------------------------- 1 | # modC/src/included.conf, modC/lib/included.conf, modC/testsrc/included.conf, modC/testlib/included.conf 2 | include "included" 3 | -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/testsrc/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/multimodule/modC/testsrc/included.conf -------------------------------------------------------------------------------- /testdata/includes/multimodule/modC/testsrc/including.conf: -------------------------------------------------------------------------------- 1 | # modC/src/included.conf, modC/lib/included.conf, modC/testsrc/included.conf, modC/testlib/included.conf 2 | include "included" 3 | -------------------------------------------------------------------------------- /testdata/includes/singlemodule/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/singlemodule/included.conf -------------------------------------------------------------------------------- /testdata/includes/singlemodule/including.conf: -------------------------------------------------------------------------------- 1 | # included.conf 2 | include "included" 3 | # included.conf 4 | include "included.conf" 5 | # 6 | include "included.json" 7 | # 8 | include "included.properties" 9 | # included.conf 10 | include "/included" 11 | # included.conf 12 | include "./included" 13 | # 14 | include "../included" 15 | # pkg/included.conf 16 | include "pkg/included" 17 | # pkg/included.conf 18 | include "/pkg/included" 19 | # included.conf 20 | include classpath("included.conf") 21 | # included.conf 22 | include classpath("included") 23 | # included.conf 24 | include file("included") 25 | # props/included.properties 26 | include "props/included" 27 | # propsjson/included.json, propsjson/included.properties 28 | include "propsjson/included" 29 | # propsjsonconf/included.conf, propsjsonconf/included.json, propsjsonconf/included.properties 30 | include "propsjsonconf/included" 31 | 32 | include "http://validUrl" 33 | include url("http://validUrl") 34 | include file("/some/absolute/file") -------------------------------------------------------------------------------- /testdata/includes/singlemodule/pkg/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/singlemodule/pkg/included.conf -------------------------------------------------------------------------------- /testdata/includes/singlemodule/pkg/including.conf: -------------------------------------------------------------------------------- 1 | # pkg/included.conf 2 | include "included" 3 | # pkg/included.conf 4 | include "included.conf" 5 | # 6 | include "included.json" 7 | # 8 | include "included.properties" 9 | # included.conf 10 | include "/included" 11 | # pkg/included.conf 12 | include "./included" 13 | # included.conf 14 | include "../included" 15 | # 16 | include "pkg/included" 17 | # pkg/included.conf 18 | include "/pkg/included" 19 | # included.conf 20 | include classpath("included.conf") 21 | # pkg/included.conf 22 | include file("pkg/included") -------------------------------------------------------------------------------- /testdata/includes/singlemodule/props/included.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/singlemodule/props/included.properties -------------------------------------------------------------------------------- /testdata/includes/singlemodule/propsjson/included.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/singlemodule/propsjson/included.json -------------------------------------------------------------------------------- /testdata/includes/singlemodule/propsjson/included.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/singlemodule/propsjson/included.properties -------------------------------------------------------------------------------- /testdata/includes/singlemodule/propsjsonconf/included.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/singlemodule/propsjsonconf/included.conf -------------------------------------------------------------------------------- /testdata/includes/singlemodule/propsjsonconf/included.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/singlemodule/propsjsonconf/included.json -------------------------------------------------------------------------------- /testdata/includes/singlemodule/propsjsonconf/included.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVSystem/intellij-hocon/97d438477dcdeabfbd76e4bb189d8ebaa2e53673/testdata/includes/singlemodule/propsjsonconf/included.properties -------------------------------------------------------------------------------- /testdata/javaClassRefs/application.conf: -------------------------------------------------------------------------------- 1 | prop = pkg.Main -------------------------------------------------------------------------------- /testdata/javaClassRefs/pkg/Main.java: -------------------------------------------------------------------------------- 1 | package pkg; 2 | 3 | public class Main { 4 | } 5 | -------------------------------------------------------------------------------- /testdata/javaLiteralRefs/application.conf: -------------------------------------------------------------------------------- 1 | this.thing.here = 5 -------------------------------------------------------------------------------- /testdata/javaLiteralRefs/pkg/Main.java: -------------------------------------------------------------------------------- 1 | package pkg; 2 | 3 | public class Main { 4 | public static final String REF = "this.thing.here"; 5 | } -------------------------------------------------------------------------------- /testdata/lexer/SCL8593.test: -------------------------------------------------------------------------------- 1 | x.fun="CREATE THIS "${cass.key}"."""${cas.t}""" "( 2 | sym_id ascii, 3 | ts timestamp, 4 | val decimal, 5 | prev_val decimal, 6 | PRIMARY KEY (sym_id, ts) 7 | ) WITH CLUSTERING ORDER BY ( ts DESC )" 8 | ----- 9 | UNQUOTED_CHARS {x} 10 | PERIOD {.} 11 | UNQUOTED_CHARS {fun} 12 | EQUALS {=} 13 | QUOTED_STRING {"CREATE THIS "} 14 | DOLLAR {$} 15 | SUB_LBRACE {{} 16 | UNQUOTED_CHARS {cass} 17 | PERIOD {.} 18 | UNQUOTED_CHARS {key} 19 | SUB_RBRACE {}} 20 | QUOTED_STRING {"."} 21 | QUOTED_STRING {""} 22 | DOLLAR {$} 23 | SUB_LBRACE {{} 24 | UNQUOTED_CHARS {cas} 25 | PERIOD {.} 26 | UNQUOTED_CHARS {t} 27 | SUB_RBRACE {}} 28 | MULTILINE_STRING {""" "( 29 | sym_id ascii, 30 | ts timestamp, 31 | val decimal, 32 | prev_val decimal, 33 | PRIMARY KEY (sym_id, ts) 34 | ) WITH CLUSTERING ORDER BY ( ts DESC )"} 35 | -------------------------------------------------------------------------------- /testdata/lexer/assignment.test: -------------------------------------------------------------------------------- 1 | key=value 2 | key:value 3 | key+=value 4 | ----- 5 | UNQUOTED_CHARS {key} 6 | EQUALS {=} 7 | UNQUOTED_CHARS {value} 8 | LINE_BREAKING_WHITESPACE { 9 | } 10 | UNQUOTED_CHARS {key} 11 | COLON {:} 12 | UNQUOTED_CHARS {value} 13 | LINE_BREAKING_WHITESPACE { 14 | } 15 | UNQUOTED_CHARS {key} 16 | PLUS_EQUALS {+=} 17 | UNQUOTED_CHARS {value} 18 | -------------------------------------------------------------------------------- /testdata/lexer/badSubstitution.test: -------------------------------------------------------------------------------- 1 | $ {something} 2 | ${ ?something} 3 | ----- 4 | DOLLAR {$} 5 | INLINE_WHITESPACE { } 6 | LBRACE {{} 7 | UNQUOTED_CHARS {something} 8 | RBRACE {}} 9 | LINE_BREAKING_WHITESPACE { 10 | } 11 | DOLLAR {$} 12 | SUB_LBRACE {{} 13 | INLINE_WHITESPACE { } 14 | BAD_CHARACTER {?} 15 | UNQUOTED_CHARS {something} 16 | SUB_RBRACE {}} 17 | -------------------------------------------------------------------------------- /testdata/lexer/badchars.test: -------------------------------------------------------------------------------- 1 | *^$&@+?`\ 2 | ----- 3 | BAD_CHARACTER {*} 4 | BAD_CHARACTER {^} 5 | DOLLAR {$} 6 | BAD_CHARACTER {&} 7 | BAD_CHARACTER {@} 8 | BAD_CHARACTER {+} 9 | BAD_CHARACTER {?} 10 | BAD_CHARACTER {`} 11 | BAD_CHARACTER {\} 12 | -------------------------------------------------------------------------------- /testdata/lexer/braces.test: -------------------------------------------------------------------------------- 1 | { key = value, key = value } 2 | ----- 3 | LBRACE {{} 4 | INLINE_WHITESPACE { } 5 | UNQUOTED_CHARS {key} 6 | INLINE_WHITESPACE { } 7 | EQUALS {=} 8 | INLINE_WHITESPACE { } 9 | UNQUOTED_CHARS {value} 10 | COMMA {,} 11 | INLINE_WHITESPACE { } 12 | UNQUOTED_CHARS {key} 13 | INLINE_WHITESPACE { } 14 | EQUALS {=} 15 | INLINE_WHITESPACE { } 16 | UNQUOTED_CHARS {value} 17 | INLINE_WHITESPACE { } 18 | RBRACE {}} 19 | -------------------------------------------------------------------------------- /testdata/lexer/brackets.test: -------------------------------------------------------------------------------- 1 | [1, 2, 3] 2 | ----- 3 | LBRACKET {[} 4 | UNQUOTED_CHARS {1} 5 | COMMA {,} 6 | INLINE_WHITESPACE { } 7 | UNQUOTED_CHARS {2} 8 | COMMA {,} 9 | INLINE_WHITESPACE { } 10 | UNQUOTED_CHARS {3} 11 | RBRACKET {]} -------------------------------------------------------------------------------- /testdata/lexer/comments.test: -------------------------------------------------------------------------------- 1 | something #comment more more ## // moar 2 | something else // more comments 3 | ----- 4 | UNQUOTED_CHARS {something} 5 | INLINE_WHITESPACE { } 6 | HASH_COMMENT {#comment more more ## // moar} 7 | LINE_BREAKING_WHITESPACE { 8 | } 9 | UNQUOTED_CHARS {something} 10 | INLINE_WHITESPACE { } 11 | UNQUOTED_CHARS {else} 12 | INLINE_WHITESPACE { } 13 | DOUBLE_SLASH_COMMENT {// more comments} 14 | -------------------------------------------------------------------------------- /testdata/lexer/complex.test: -------------------------------------------------------------------------------- 1 | # hash comment 2 | // double slash comment 3 | 4 | include classpath("included.conf") 5 | 6 | object.subobject { 7 | someList = [ 8 | null, 9 | true, 10 | 123.4e5, 11 | unquoted string *, 12 | "quo\nted\d string", 13 | ${?substitution.inner}concat"concat", 14 | """multiline 15 | multiline""" 16 | ] 17 | } 18 | ----- 19 | HASH_COMMENT {# hash comment} 20 | LINE_BREAKING_WHITESPACE { 21 | } 22 | DOUBLE_SLASH_COMMENT {// double slash comment} 23 | LINE_BREAKING_WHITESPACE { 24 | 25 | } 26 | UNQUOTED_CHARS {include} 27 | INLINE_WHITESPACE { } 28 | UNQUOTED_CHARS {classpath} 29 | LPAREN {(} 30 | QUOTED_STRING {"included.conf"} 31 | RPAREN {)} 32 | LINE_BREAKING_WHITESPACE { 33 | 34 | } 35 | UNQUOTED_CHARS {object} 36 | PERIOD {.} 37 | UNQUOTED_CHARS {subobject} 38 | INLINE_WHITESPACE { } 39 | LBRACE {{} 40 | LINE_BREAKING_WHITESPACE { 41 | } 42 | UNQUOTED_CHARS {someList} 43 | INLINE_WHITESPACE { } 44 | EQUALS {=} 45 | INLINE_WHITESPACE { } 46 | LBRACKET {[} 47 | LINE_BREAKING_WHITESPACE { 48 | } 49 | UNQUOTED_CHARS {null} 50 | COMMA {,} 51 | LINE_BREAKING_WHITESPACE { 52 | } 53 | UNQUOTED_CHARS {true} 54 | COMMA {,} 55 | LINE_BREAKING_WHITESPACE { 56 | } 57 | UNQUOTED_CHARS {123} 58 | PERIOD {.} 59 | UNQUOTED_CHARS {4e5} 60 | COMMA {,} 61 | LINE_BREAKING_WHITESPACE { 62 | } 63 | UNQUOTED_CHARS {unquoted} 64 | INLINE_WHITESPACE { } 65 | UNQUOTED_CHARS {string} 66 | INLINE_WHITESPACE { } 67 | BAD_CHARACTER {*} 68 | COMMA {,} 69 | LINE_BREAKING_WHITESPACE { 70 | } 71 | QUOTED_STRING {"quo\nted\d string"} 72 | COMMA {,} 73 | LINE_BREAKING_WHITESPACE { 74 | } 75 | DOLLAR {$} 76 | SUB_LBRACE {{} 77 | QMARK {?} 78 | UNQUOTED_CHARS {substitution} 79 | PERIOD {.} 80 | UNQUOTED_CHARS {inner} 81 | SUB_RBRACE {}} 82 | UNQUOTED_CHARS {concat} 83 | QUOTED_STRING {"concat"} 84 | COMMA {,} 85 | LINE_BREAKING_WHITESPACE { 86 | } 87 | MULTILINE_STRING {"""multiline 88 | multiline"""} 89 | LINE_BREAKING_WHITESPACE { 90 | } 91 | RBRACKET {]} 92 | LINE_BREAKING_WHITESPACE { 93 | } 94 | RBRACE {}} -------------------------------------------------------------------------------- /testdata/lexer/dots.test: -------------------------------------------------------------------------------- 1 | some.thing.more 2 | ----- 3 | UNQUOTED_CHARS {some} 4 | PERIOD {.} 5 | UNQUOTED_CHARS {thing} 6 | PERIOD {.} 7 | UNQUOTED_CHARS {more} 8 | -------------------------------------------------------------------------------- /testdata/lexer/multiline.test: -------------------------------------------------------------------------------- 1 | "quoted"""""" 2 | ""something 3 | more""""""unquoted 4 | ----- 5 | QUOTED_STRING {"quoted"} 6 | MULTILINE_STRING {""""" 7 | ""something 8 | more""""""} 9 | UNQUOTED_CHARS {unquoted} 10 | -------------------------------------------------------------------------------- /testdata/lexer/optionalSubstitution.test: -------------------------------------------------------------------------------- 1 | ${?some.path.here} 2 | ----- 3 | DOLLAR {$} 4 | SUB_LBRACE {{} 5 | QMARK {?} 6 | UNQUOTED_CHARS {some} 7 | PERIOD {.} 8 | UNQUOTED_CHARS {path} 9 | PERIOD {.} 10 | UNQUOTED_CHARS {here} 11 | SUB_RBRACE {}} 12 | -------------------------------------------------------------------------------- /testdata/lexer/quoting.test: -------------------------------------------------------------------------------- 1 | some(th)ing"aaaa\"aaaa"else 2 | ----- 3 | UNQUOTED_CHARS {some} 4 | LPAREN {(} 5 | UNQUOTED_CHARS {th} 6 | RPAREN {)} 7 | UNQUOTED_CHARS {ing} 8 | QUOTED_STRING {"aaaa\"aaaa"} 9 | UNQUOTED_CHARS {else} 10 | -------------------------------------------------------------------------------- /testdata/lexer/substitution.test: -------------------------------------------------------------------------------- 1 | ${some.path.here} 2 | ----- 3 | DOLLAR {$} 4 | SUB_LBRACE {{} 5 | UNQUOTED_CHARS {some} 6 | PERIOD {.} 7 | UNQUOTED_CHARS {path} 8 | PERIOD {.} 9 | UNQUOTED_CHARS {here} 10 | SUB_RBRACE {}} -------------------------------------------------------------------------------- /testdata/lexer/unclosedSubstitution.test: -------------------------------------------------------------------------------- 1 | ${some.path.here 2 | } 3 | ----- 4 | DOLLAR {$} 5 | SUB_LBRACE {{} 6 | UNQUOTED_CHARS {some} 7 | PERIOD {.} 8 | UNQUOTED_CHARS {path} 9 | PERIOD {.} 10 | UNQUOTED_CHARS {here} 11 | LINE_BREAKING_WHITESPACE { 12 | } 13 | RBRACE {}} 14 | -------------------------------------------------------------------------------- /testdata/manipulators/key/dotAppearInKey.test: -------------------------------------------------------------------------------- 1 | simple = null 2 | ----- 3 | [two.parts] 4 | ----- 5 | "two.parts" = null 6 | -------------------------------------------------------------------------------- /testdata/manipulators/key/multipleParts.test: -------------------------------------------------------------------------------- 1 | some"thing"more = null 2 | ----- 3 | [content] 4 | ----- 5 | "content" = null 6 | -------------------------------------------------------------------------------- /testdata/manipulators/key/quotedWithEscaping.test: -------------------------------------------------------------------------------- 1 | "simple" = null 2 | ----- 3 | [multi 4 | line] 5 | ----- 6 | "multi\nline" = null 7 | -------------------------------------------------------------------------------- /testdata/manipulators/key/simpleInKey.test: -------------------------------------------------------------------------------- 1 | simple = null 2 | ----- 3 | [other] 4 | ----- 5 | other = null 6 | -------------------------------------------------------------------------------- /testdata/manipulators/key/simpleMultiline.test: -------------------------------------------------------------------------------- 1 | """value""" = null 2 | ----- 3 | [some 4 | multi 5 | line 6 | text] 7 | ----- 8 | """some 9 | multi 10 | line 11 | text""" = null -------------------------------------------------------------------------------- /testdata/manipulators/key/simpleQuoted.test: -------------------------------------------------------------------------------- 1 | "simple" = null 2 | ----- 3 | [other] 4 | ----- 5 | "other" = null 6 | -------------------------------------------------------------------------------- /testdata/manipulators/key/simpleUnquoted.test: -------------------------------------------------------------------------------- 1 | simple = null 2 | ----- 3 | [other] 4 | ----- 5 | other = null 6 | -------------------------------------------------------------------------------- /testdata/manipulators/key/unquotedForbiddenChars.test: -------------------------------------------------------------------------------- 1 | simple = null 2 | ----- 3 | [ab$cd] 4 | ----- 5 | "ab$cd" = null 6 | -------------------------------------------------------------------------------- /testdata/manipulators/key/unquotedToEmpty.test: -------------------------------------------------------------------------------- 1 | simple = null 2 | ----- 3 | [] 4 | ----- 5 | "" = null 6 | -------------------------------------------------------------------------------- /testdata/manipulators/key/unquotedWhitespace.test: -------------------------------------------------------------------------------- 1 | simple = null 2 | ----- 3 | [ other ] 4 | ----- 5 | " other " = null 6 | -------------------------------------------------------------------------------- /testdata/manipulators/key/unquotedWithEscaping.test: -------------------------------------------------------------------------------- 1 | simple = null 2 | ----- 3 | [multi 4 | line] 5 | ----- 6 | "multi\nline" = null 7 | -------------------------------------------------------------------------------- /testdata/manipulators/string/dotAppearInKey.test: -------------------------------------------------------------------------------- 1 | simple = null 2 | ----- 3 | [two.parts] 4 | ----- 5 | "two.parts" = null 6 | -------------------------------------------------------------------------------- /testdata/manipulators/string/dotAppearInValue.test: -------------------------------------------------------------------------------- 1 | k = simple 2 | ----- 3 | [two.parts] 4 | ----- 5 | k = two.parts 6 | -------------------------------------------------------------------------------- /testdata/manipulators/string/quotedWithEscaping.test: -------------------------------------------------------------------------------- 1 | k = "simple" 2 | ----- 3 | [multi 4 | line] 5 | ----- 6 | k = "multi\nline" 7 | -------------------------------------------------------------------------------- /testdata/manipulators/string/simpleInInclude.test: -------------------------------------------------------------------------------- 1 | include "simple" 2 | ----- 3 | [other] 4 | ----- 5 | include "other" 6 | -------------------------------------------------------------------------------- /testdata/manipulators/string/simpleInKey.test: -------------------------------------------------------------------------------- 1 | simple = null 2 | ----- 3 | [other] 4 | ----- 5 | other = null 6 | -------------------------------------------------------------------------------- /testdata/manipulators/string/simpleMultiline.test: -------------------------------------------------------------------------------- 1 | k = """value""" 2 | ----- 3 | [some 4 | multi 5 | line 6 | text] 7 | ----- 8 | k = """some 9 | multi 10 | line 11 | text""" 12 | -------------------------------------------------------------------------------- /testdata/manipulators/string/simpleQuoted.test: -------------------------------------------------------------------------------- 1 | k = "simple" 2 | ----- 3 | [other] 4 | ----- 5 | k = "other" 6 | -------------------------------------------------------------------------------- /testdata/manipulators/string/simpleUnquoted.test: -------------------------------------------------------------------------------- 1 | k = simple 2 | ----- 3 | [other] 4 | ----- 5 | k = other 6 | -------------------------------------------------------------------------------- /testdata/manipulators/string/unclosedQuoted.test: -------------------------------------------------------------------------------- 1 | k = "value 2 | ----- 3 | [other] 4 | ----- 5 | k = "other 6 | -------------------------------------------------------------------------------- /testdata/manipulators/string/unquotedForbiddenChars.test: -------------------------------------------------------------------------------- 1 | k = simple 2 | ----- 3 | [ab$cd] 4 | ----- 5 | k = "ab$cd" 6 | -------------------------------------------------------------------------------- /testdata/manipulators/string/unquotedToEmpty.test: -------------------------------------------------------------------------------- 1 | k = simple 2 | ----- 3 | [] 4 | ----- 5 | k = "" 6 | -------------------------------------------------------------------------------- /testdata/manipulators/string/unquotedWhitespace.test: -------------------------------------------------------------------------------- 1 | k = simple 2 | ----- 3 | [ other ] 4 | ----- 5 | k = " other " 6 | -------------------------------------------------------------------------------- /testdata/manipulators/string/unquotedWithEscaping.test: -------------------------------------------------------------------------------- 1 | k = simple 2 | ----- 3 | [multi 4 | line] 5 | ----- 6 | k = "multi\nline" 7 | -------------------------------------------------------------------------------- /testdata/parser/array.test: -------------------------------------------------------------------------------- 1 | list=[1,2 2 | 3, 3 | 4,] 4 | ----- 5 | HOCON_FILE 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HValuedField(VALUED_FIELD) 9 | HFieldKey(FIELD_KEY) 10 | HKeyPart(KEY_PART) 11 | HUnquotedString(UNQUOTED_STRING) 12 | PsiElement(UNQUOTED_CHARS)('list') 13 | PsiElement(EQUALS)('=') 14 | HArray(ARRAY) 15 | PsiElement(LBRACKET)('[') 16 | HNumber(NUMBER) 17 | PsiElement(UNQUOTED_CHARS)('1') 18 | PsiElement(COMMA)(',') 19 | HNumber(NUMBER) 20 | PsiElement(UNQUOTED_CHARS)('2') 21 | PsiWhiteSpace('\n') 22 | HNumber(NUMBER) 23 | PsiElement(UNQUOTED_CHARS)('3') 24 | PsiElement(COMMA)(',') 25 | PsiWhiteSpace('\n') 26 | HNumber(NUMBER) 27 | PsiElement(UNQUOTED_CHARS)('4') 28 | PsiElement(COMMA)(',') 29 | PsiElement(RBRACKET)(']') 30 | -------------------------------------------------------------------------------- /testdata/parser/badCharactersInKey.test: -------------------------------------------------------------------------------- 1 | k@k = value 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HObjectField(OBJECT_FIELD) 6 | HValuedField(VALUED_FIELD) 7 | HFieldKey(FIELD_KEY) 8 | HKeyPart(KEY_PART) 9 | HUnquotedString(UNQUOTED_STRING) 10 | PsiElement(UNQUOTED_CHARS)('k') 11 | PsiErrorElement:key must be a concatenation of unquoted, quoted or multiline strings (characters $ " { } [ ] : = , + # ` ^ ? ! @ * & \ are forbidden unquoted) 12 | PsiElement(BAD_CHARACTER)('@') 13 | HKeyPart(KEY_PART) 14 | HUnquotedString(UNQUOTED_STRING) 15 | PsiElement(UNQUOTED_CHARS)('k') 16 | PsiWhiteSpace(' ') 17 | PsiElement(EQUALS)('=') 18 | PsiWhiteSpace(' ') 19 | HStringValue(STRING_VALUE) 20 | HUnquotedString(UNQUOTED_STRING) 21 | PsiElement(UNQUOTED_CHARS)('value') 22 | -------------------------------------------------------------------------------- /testdata/parser/badCharactersInValue.test: -------------------------------------------------------------------------------- 1 | k = v@v 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HObjectField(OBJECT_FIELD) 6 | HValuedField(VALUED_FIELD) 7 | HFieldKey(FIELD_KEY) 8 | HKeyPart(KEY_PART) 9 | HUnquotedString(UNQUOTED_STRING) 10 | PsiElement(UNQUOTED_CHARS)('k') 11 | PsiWhiteSpace(' ') 12 | PsiElement(EQUALS)('=') 13 | PsiWhiteSpace(' ') 14 | HConcatenation(CONCATENATION) 15 | HStringValue(STRING_VALUE) 16 | HUnquotedString(UNQUOTED_STRING) 17 | PsiElement(UNQUOTED_CHARS)('v') 18 | PsiErrorElement:characters $ " { } [ ] : = , + # ` ^ ? ! @ * & \ are forbidden unquoted 19 | PsiElement(BAD_CHARACTER)('@') 20 | HStringValue(STRING_VALUE) 21 | HUnquotedString(UNQUOTED_STRING) 22 | PsiElement(UNQUOTED_CHARS)('v') 23 | -------------------------------------------------------------------------------- /testdata/parser/badIncludeTarget.test: -------------------------------------------------------------------------------- 1 | include stuff 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HInclude(INCLUDE) 6 | PsiElement(UNQUOTED_CHARS)('include') 7 | PsiWhiteSpace(' ') 8 | HIncluded(INCLUDED) 9 | HQualifiedIncluded(QUALIFIED_INCLUDED) 10 | PsiErrorElement:expected quoted string, optionally wrapped in 'url(...)', 'file(...)' or 'classpath(...)' 11 | PsiElement(UNQUOTED_CHARS)('stuff') 12 | -------------------------------------------------------------------------------- /testdata/parser/boolean.test: -------------------------------------------------------------------------------- 1 | key = true 2 | key = false 3 | key = true ...not 4 | key = not true 5 | ----- 6 | HOCON_FILE 7 | HObjectEntries(OBJECT_ENTRIES) 8 | HObjectField(OBJECT_FIELD) 9 | HValuedField(VALUED_FIELD) 10 | HFieldKey(FIELD_KEY) 11 | HKeyPart(KEY_PART) 12 | HUnquotedString(UNQUOTED_STRING) 13 | PsiElement(UNQUOTED_CHARS)('key') 14 | PsiWhiteSpace(' ') 15 | PsiElement(EQUALS)('=') 16 | PsiWhiteSpace(' ') 17 | HBoolean(BOOLEAN) 18 | PsiElement(UNQUOTED_CHARS)('true') 19 | PsiWhiteSpace('\n') 20 | HObjectField(OBJECT_FIELD) 21 | HValuedField(VALUED_FIELD) 22 | HFieldKey(FIELD_KEY) 23 | HKeyPart(KEY_PART) 24 | HUnquotedString(UNQUOTED_STRING) 25 | PsiElement(UNQUOTED_CHARS)('key') 26 | PsiWhiteSpace(' ') 27 | PsiElement(EQUALS)('=') 28 | PsiWhiteSpace(' ') 29 | HBoolean(BOOLEAN) 30 | PsiElement(UNQUOTED_CHARS)('false') 31 | PsiWhiteSpace('\n') 32 | HObjectField(OBJECT_FIELD) 33 | HValuedField(VALUED_FIELD) 34 | HFieldKey(FIELD_KEY) 35 | HKeyPart(KEY_PART) 36 | HUnquotedString(UNQUOTED_STRING) 37 | PsiElement(UNQUOTED_CHARS)('key') 38 | PsiWhiteSpace(' ') 39 | PsiElement(EQUALS)('=') 40 | PsiWhiteSpace(' ') 41 | HStringValue(STRING_VALUE) 42 | HUnquotedString(UNQUOTED_STRING) 43 | PsiElement(UNQUOTED_CHARS)('true') 44 | PsiWhiteSpace(' ') 45 | PsiElement(PERIOD)('.') 46 | PsiElement(PERIOD)('.') 47 | PsiElement(PERIOD)('.') 48 | PsiElement(UNQUOTED_CHARS)('not') 49 | PsiWhiteSpace('\n') 50 | HObjectField(OBJECT_FIELD) 51 | HValuedField(VALUED_FIELD) 52 | HFieldKey(FIELD_KEY) 53 | HKeyPart(KEY_PART) 54 | HUnquotedString(UNQUOTED_STRING) 55 | PsiElement(UNQUOTED_CHARS)('key') 56 | PsiWhiteSpace(' ') 57 | PsiElement(EQUALS)('=') 58 | PsiWhiteSpace(' ') 59 | HStringValue(STRING_VALUE) 60 | HUnquotedString(UNQUOTED_STRING) 61 | PsiElement(UNQUOTED_CHARS)('not') 62 | PsiWhiteSpace(' ') 63 | PsiElement(UNQUOTED_CHARS)('true') 64 | -------------------------------------------------------------------------------- /testdata/parser/danglingComma.test: -------------------------------------------------------------------------------- 1 | {k=v,k=v,} 2 | ----- 3 | HOCON_FILE 4 | HObject(OBJECT) 5 | PsiElement(LBRACE)('{') 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HValuedField(VALUED_FIELD) 9 | HFieldKey(FIELD_KEY) 10 | HKeyPart(KEY_PART) 11 | HUnquotedString(UNQUOTED_STRING) 12 | PsiElement(UNQUOTED_CHARS)('k') 13 | PsiElement(EQUALS)('=') 14 | HStringValue(STRING_VALUE) 15 | HUnquotedString(UNQUOTED_STRING) 16 | PsiElement(UNQUOTED_CHARS)('v') 17 | PsiElement(COMMA)(',') 18 | HObjectField(OBJECT_FIELD) 19 | HValuedField(VALUED_FIELD) 20 | HFieldKey(FIELD_KEY) 21 | HKeyPart(KEY_PART) 22 | HUnquotedString(UNQUOTED_STRING) 23 | PsiElement(UNQUOTED_CHARS)('k') 24 | PsiElement(EQUALS)('=') 25 | HStringValue(STRING_VALUE) 26 | HUnquotedString(UNQUOTED_STRING) 27 | PsiElement(UNQUOTED_CHARS)('v') 28 | PsiElement(COMMA)(',') 29 | PsiElement(RBRACE)('}') 30 | -------------------------------------------------------------------------------- /testdata/parser/documentationComments.test: -------------------------------------------------------------------------------- 1 | # not doc comment 2 | // not doc comment 3 | #doc comment 4 | #more doc comment 5 | key = value 6 | 7 | # not doc comment 8 | 9 | key = value 10 | ----- 11 | HOCON_FILE 12 | HObjectEntries(OBJECT_ENTRIES) 13 | PsiComment(HASH_COMMENT)('# not doc comment') 14 | PsiWhiteSpace('\n') 15 | PsiComment(DOUBLE_SLASH_COMMENT)('// not doc comment') 16 | PsiWhiteSpace('\n') 17 | HObjectField(OBJECT_FIELD) 18 | PsiComment(HASH_COMMENT)('#doc comment') 19 | PsiWhiteSpace('\n') 20 | PsiComment(HASH_COMMENT)('#more doc comment') 21 | PsiWhiteSpace('\n') 22 | HValuedField(VALUED_FIELD) 23 | HFieldKey(FIELD_KEY) 24 | HKeyPart(KEY_PART) 25 | HUnquotedString(UNQUOTED_STRING) 26 | PsiElement(UNQUOTED_CHARS)('key') 27 | PsiWhiteSpace(' ') 28 | PsiElement(EQUALS)('=') 29 | PsiWhiteSpace(' ') 30 | HStringValue(STRING_VALUE) 31 | HUnquotedString(UNQUOTED_STRING) 32 | PsiElement(UNQUOTED_CHARS)('value') 33 | PsiWhiteSpace('\n\n') 34 | PsiComment(HASH_COMMENT)('# not doc comment') 35 | PsiWhiteSpace('\n\n') 36 | HObjectField(OBJECT_FIELD) 37 | HValuedField(VALUED_FIELD) 38 | HFieldKey(FIELD_KEY) 39 | HKeyPart(KEY_PART) 40 | HUnquotedString(UNQUOTED_STRING) 41 | PsiElement(UNQUOTED_CHARS)('key') 42 | PsiWhiteSpace(' ') 43 | PsiElement(EQUALS)('=') 44 | PsiWhiteSpace(' ') 45 | HStringValue(STRING_VALUE) 46 | HUnquotedString(UNQUOTED_STRING) 47 | PsiElement(UNQUOTED_CHARS)('value') 48 | -------------------------------------------------------------------------------- /testdata/parser/dollarInKey.test: -------------------------------------------------------------------------------- 1 | $key = 42 2 | ke$y = 42 3 | key$ = 42 4 | ----- 5 | HOCON_FILE 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HValuedField(VALUED_FIELD) 9 | HFieldKey(FIELD_KEY) 10 | PsiErrorElement:key must be a concatenation of unquoted, quoted or multiline strings (characters $ " { } [ ] : = , + # ` ^ ? ! @ * & \ are forbidden unquoted) 11 | PsiElement(DOLLAR)('$') 12 | HKeyPart(KEY_PART) 13 | HUnquotedString(UNQUOTED_STRING) 14 | PsiElement(UNQUOTED_CHARS)('key') 15 | PsiWhiteSpace(' ') 16 | PsiElement(EQUALS)('=') 17 | PsiWhiteSpace(' ') 18 | HNumber(NUMBER) 19 | PsiElement(UNQUOTED_CHARS)('42') 20 | PsiWhiteSpace('\n') 21 | HObjectField(OBJECT_FIELD) 22 | HValuedField(VALUED_FIELD) 23 | HFieldKey(FIELD_KEY) 24 | HKeyPart(KEY_PART) 25 | HUnquotedString(UNQUOTED_STRING) 26 | PsiElement(UNQUOTED_CHARS)('ke') 27 | PsiErrorElement:key must be a concatenation of unquoted, quoted or multiline strings (characters $ " { } [ ] : = , + # ` ^ ? ! @ * & \ are forbidden unquoted) 28 | PsiElement(DOLLAR)('$') 29 | HKeyPart(KEY_PART) 30 | HUnquotedString(UNQUOTED_STRING) 31 | PsiElement(UNQUOTED_CHARS)('y') 32 | PsiWhiteSpace(' ') 33 | PsiElement(EQUALS)('=') 34 | PsiWhiteSpace(' ') 35 | HNumber(NUMBER) 36 | PsiElement(UNQUOTED_CHARS)('42') 37 | PsiWhiteSpace('\n') 38 | HObjectField(OBJECT_FIELD) 39 | HValuedField(VALUED_FIELD) 40 | HFieldKey(FIELD_KEY) 41 | HKeyPart(KEY_PART) 42 | HUnquotedString(UNQUOTED_STRING) 43 | PsiElement(UNQUOTED_CHARS)('key') 44 | PsiErrorElement:key must be a concatenation of unquoted, quoted or multiline strings (characters $ " { } [ ] : = , + # ` ^ ? ! @ * & \ are forbidden unquoted) 45 | PsiElement(DOLLAR)('$') 46 | PsiWhiteSpace(' ') 47 | PsiElement(EQUALS)('=') 48 | PsiWhiteSpace(' ') 49 | HNumber(NUMBER) 50 | PsiElement(UNQUOTED_CHARS)('42') 51 | -------------------------------------------------------------------------------- /testdata/parser/dollarInValue.test: -------------------------------------------------------------------------------- 1 | key = $value 2 | key = va$lue 3 | key = value$ 4 | ----- 5 | HOCON_FILE 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HValuedField(VALUED_FIELD) 9 | HFieldKey(FIELD_KEY) 10 | HKeyPart(KEY_PART) 11 | HUnquotedString(UNQUOTED_STRING) 12 | PsiElement(UNQUOTED_CHARS)('key') 13 | PsiWhiteSpace(' ') 14 | PsiElement(EQUALS)('=') 15 | PsiWhiteSpace(' ') 16 | HConcatenation(CONCATENATION) 17 | PsiErrorElement:characters $ " { } [ ] : = , + # ` ^ ? ! @ * & \ are forbidden unquoted 18 | PsiElement(DOLLAR)('$') 19 | HStringValue(STRING_VALUE) 20 | HUnquotedString(UNQUOTED_STRING) 21 | PsiElement(UNQUOTED_CHARS)('value') 22 | PsiWhiteSpace('\n') 23 | HObjectField(OBJECT_FIELD) 24 | HValuedField(VALUED_FIELD) 25 | HFieldKey(FIELD_KEY) 26 | HKeyPart(KEY_PART) 27 | HUnquotedString(UNQUOTED_STRING) 28 | PsiElement(UNQUOTED_CHARS)('key') 29 | PsiWhiteSpace(' ') 30 | PsiElement(EQUALS)('=') 31 | PsiWhiteSpace(' ') 32 | HConcatenation(CONCATENATION) 33 | HStringValue(STRING_VALUE) 34 | HUnquotedString(UNQUOTED_STRING) 35 | PsiElement(UNQUOTED_CHARS)('va') 36 | PsiErrorElement:characters $ " { } [ ] : = , + # ` ^ ? ! @ * & \ are forbidden unquoted 37 | PsiElement(DOLLAR)('$') 38 | HStringValue(STRING_VALUE) 39 | HUnquotedString(UNQUOTED_STRING) 40 | PsiElement(UNQUOTED_CHARS)('lue') 41 | PsiWhiteSpace('\n') 42 | HObjectField(OBJECT_FIELD) 43 | HValuedField(VALUED_FIELD) 44 | HFieldKey(FIELD_KEY) 45 | HKeyPart(KEY_PART) 46 | HUnquotedString(UNQUOTED_STRING) 47 | PsiElement(UNQUOTED_CHARS)('key') 48 | PsiWhiteSpace(' ') 49 | PsiElement(EQUALS)('=') 50 | PsiWhiteSpace(' ') 51 | HConcatenation(CONCATENATION) 52 | HStringValue(STRING_VALUE) 53 | HUnquotedString(UNQUOTED_STRING) 54 | PsiElement(UNQUOTED_CHARS)('value') 55 | PsiErrorElement:characters $ " { } [ ] : = , + # ` ^ ? ! @ * & \ are forbidden unquoted 56 | PsiElement(DOLLAR)('$') 57 | -------------------------------------------------------------------------------- /testdata/parser/dotsInValues.test: -------------------------------------------------------------------------------- 1 | k = some.fully.qualified.ClassName 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HObjectField(OBJECT_FIELD) 6 | HValuedField(VALUED_FIELD) 7 | HFieldKey(FIELD_KEY) 8 | HKeyPart(KEY_PART) 9 | HUnquotedString(UNQUOTED_STRING) 10 | PsiElement(UNQUOTED_CHARS)('k') 11 | PsiWhiteSpace(' ') 12 | PsiElement(EQUALS)('=') 13 | PsiWhiteSpace(' ') 14 | HStringValue(STRING_VALUE) 15 | HUnquotedString(UNQUOTED_STRING) 16 | PsiElement(UNQUOTED_CHARS)('some') 17 | PsiElement(PERIOD)('.') 18 | PsiElement(UNQUOTED_CHARS)('fully') 19 | PsiElement(PERIOD)('.') 20 | PsiElement(UNQUOTED_CHARS)('qualified') 21 | PsiElement(PERIOD)('.') 22 | PsiElement(UNQUOTED_CHARS)('ClassName') 23 | -------------------------------------------------------------------------------- /testdata/parser/expectedArrayElement.test: -------------------------------------------------------------------------------- 1 | a = [1,,] 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HObjectField(OBJECT_FIELD) 6 | HValuedField(VALUED_FIELD) 7 | HFieldKey(FIELD_KEY) 8 | HKeyPart(KEY_PART) 9 | HUnquotedString(UNQUOTED_STRING) 10 | PsiElement(UNQUOTED_CHARS)('a') 11 | PsiWhiteSpace(' ') 12 | PsiElement(EQUALS)('=') 13 | PsiWhiteSpace(' ') 14 | HArray(ARRAY) 15 | PsiElement(LBRACKET)('[') 16 | HNumber(NUMBER) 17 | PsiElement(UNQUOTED_CHARS)('1') 18 | PsiElement(COMMA)(',') 19 | PsiErrorElement:expected array element or ']' 20 | PsiElement(COMMA)(',') 21 | PsiElement(RBRACKET)(']') 22 | -------------------------------------------------------------------------------- /testdata/parser/expectedAssignment.test: -------------------------------------------------------------------------------- 1 | {a} 2 | ----- 3 | HOCON_FILE 4 | HObject(OBJECT) 5 | PsiElement(LBRACE)('{') 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HValuedField(VALUED_FIELD) 9 | HFieldKey(FIELD_KEY) 10 | HKeyPart(KEY_PART) 11 | HUnquotedString(UNQUOTED_STRING) 12 | PsiElement(UNQUOTED_CHARS)('a') 13 | PsiErrorElement:expected ':', '=', '+=' or object 14 | 15 | PsiElement(RBRACE)('}') 16 | -------------------------------------------------------------------------------- /testdata/parser/expectedEof.test: -------------------------------------------------------------------------------- 1 | {}} 2 | ----- 3 | HOCON_FILE 4 | HObject(OBJECT) 5 | PsiElement(LBRACE)('{') 6 | HObjectEntries(OBJECT_ENTRIES) 7 | 8 | PsiElement(RBRACE)('}') 9 | PsiErrorElement:expected end of file 10 | PsiElement(RBRACE)('}') 11 | -------------------------------------------------------------------------------- /testdata/parser/expectedFieldValue.test: -------------------------------------------------------------------------------- 1 | {a = } 2 | ----- 3 | HOCON_FILE 4 | HObject(OBJECT) 5 | PsiElement(LBRACE)('{') 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HValuedField(VALUED_FIELD) 9 | HFieldKey(FIELD_KEY) 10 | HKeyPart(KEY_PART) 11 | HUnquotedString(UNQUOTED_STRING) 12 | PsiElement(UNQUOTED_CHARS)('a') 13 | PsiWhiteSpace(' ') 14 | PsiElement(EQUALS)('=') 15 | PsiErrorElement:expected value for object field 16 | 17 | PsiWhiteSpace(' ') 18 | PsiElement(RBRACE)('}') 19 | -------------------------------------------------------------------------------- /testdata/parser/expectedObjectField.test: -------------------------------------------------------------------------------- 1 | {a = b,,} 2 | ----- 3 | HOCON_FILE 4 | HObject(OBJECT) 5 | PsiElement(LBRACE)('{') 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HValuedField(VALUED_FIELD) 9 | HFieldKey(FIELD_KEY) 10 | HKeyPart(KEY_PART) 11 | HUnquotedString(UNQUOTED_STRING) 12 | PsiElement(UNQUOTED_CHARS)('a') 13 | PsiWhiteSpace(' ') 14 | PsiElement(EQUALS)('=') 15 | PsiWhiteSpace(' ') 16 | HStringValue(STRING_VALUE) 17 | HUnquotedString(UNQUOTED_STRING) 18 | PsiElement(UNQUOTED_CHARS)('b') 19 | PsiElement(COMMA)(',') 20 | PsiErrorElement:expected object field, include or '}' 21 | PsiElement(COMMA)(',') 22 | PsiElement(RBRACE)('}') 23 | -------------------------------------------------------------------------------- /testdata/parser/expectedObjectFieldToplevel.test: -------------------------------------------------------------------------------- 1 | a = b,, 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HObjectField(OBJECT_FIELD) 6 | HValuedField(VALUED_FIELD) 7 | HFieldKey(FIELD_KEY) 8 | HKeyPart(KEY_PART) 9 | HUnquotedString(UNQUOTED_STRING) 10 | PsiElement(UNQUOTED_CHARS)('a') 11 | PsiWhiteSpace(' ') 12 | PsiElement(EQUALS)('=') 13 | PsiWhiteSpace(' ') 14 | HStringValue(STRING_VALUE) 15 | HUnquotedString(UNQUOTED_STRING) 16 | PsiElement(UNQUOTED_CHARS)('b') 17 | PsiElement(COMMA)(',') 18 | PsiErrorElement:expected object field or include 19 | PsiElement(COMMA)(',') 20 | -------------------------------------------------------------------------------- /testdata/parser/expectedPathInSub.test: -------------------------------------------------------------------------------- 1 | a = ${} 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HObjectField(OBJECT_FIELD) 6 | HValuedField(VALUED_FIELD) 7 | HFieldKey(FIELD_KEY) 8 | HKeyPart(KEY_PART) 9 | HUnquotedString(UNQUOTED_STRING) 10 | PsiElement(UNQUOTED_CHARS)('a') 11 | PsiWhiteSpace(' ') 12 | PsiElement(EQUALS)('=') 13 | PsiWhiteSpace(' ') 14 | HSubstitution(SUBSTITUTION) 15 | PsiElement(DOLLAR)('$') 16 | PsiElement(SUB_LBRACE)('{') 17 | PsiErrorElement:expected path expression 18 | 19 | PsiElement(SUB_RBRACE)('}') 20 | -------------------------------------------------------------------------------- /testdata/parser/expectedQuotedStringInclude.test: -------------------------------------------------------------------------------- 1 | include url(${a}) 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HInclude(INCLUDE) 6 | PsiElement(UNQUOTED_CHARS)('include') 7 | PsiWhiteSpace(' ') 8 | HIncluded(INCLUDED) 9 | HQualifiedIncluded(QUALIFIED_INCLUDED) 10 | PsiElement(UNQUOTED_CHARS)('url') 11 | PsiElement(LPAREN)('(') 12 | PsiErrorElement:expected quoted string 13 | PsiElement(DOLLAR)('$') 14 | PsiElement(SUB_LBRACE)('{') 15 | PsiElement(UNQUOTED_CHARS)('a') 16 | PsiElement(SUB_RBRACE)('}') 17 | PsiElement(RPAREN)(')') 18 | -------------------------------------------------------------------------------- /testdata/parser/expectedRbrace.test: -------------------------------------------------------------------------------- 1 | {a = b 2 | ----- 3 | HOCON_FILE 4 | HObject(OBJECT) 5 | PsiElement(LBRACE)('{') 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HValuedField(VALUED_FIELD) 9 | HFieldKey(FIELD_KEY) 10 | HKeyPart(KEY_PART) 11 | HUnquotedString(UNQUOTED_STRING) 12 | PsiElement(UNQUOTED_CHARS)('a') 13 | PsiWhiteSpace(' ') 14 | PsiElement(EQUALS)('=') 15 | PsiWhiteSpace(' ') 16 | HStringValue(STRING_VALUE) 17 | HUnquotedString(UNQUOTED_STRING) 18 | PsiElement(UNQUOTED_CHARS)('b') 19 | PsiErrorElement:expected '}' 20 | 21 | -------------------------------------------------------------------------------- /testdata/parser/expectedRbracket.test: -------------------------------------------------------------------------------- 1 | {a = [1} 2 | ----- 3 | HOCON_FILE 4 | HObject(OBJECT) 5 | PsiElement(LBRACE)('{') 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HValuedField(VALUED_FIELD) 9 | HFieldKey(FIELD_KEY) 10 | HKeyPart(KEY_PART) 11 | HUnquotedString(UNQUOTED_STRING) 12 | PsiElement(UNQUOTED_CHARS)('a') 13 | PsiWhiteSpace(' ') 14 | PsiElement(EQUALS)('=') 15 | PsiWhiteSpace(' ') 16 | HArray(ARRAY) 17 | PsiElement(LBRACKET)('[') 18 | HNumber(NUMBER) 19 | PsiElement(UNQUOTED_CHARS)('1') 20 | PsiErrorElement:expected ']' 21 | 22 | PsiElement(RBRACE)('}') 23 | -------------------------------------------------------------------------------- /testdata/parser/expectedRparen.test: -------------------------------------------------------------------------------- 1 | include file("stuff" 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HInclude(INCLUDE) 6 | PsiElement(UNQUOTED_CHARS)('include') 7 | PsiWhiteSpace(' ') 8 | HIncluded(INCLUDED) 9 | HQualifiedIncluded(QUALIFIED_INCLUDED) 10 | PsiElement(UNQUOTED_CHARS)('file') 11 | PsiElement(LPAREN)('(') 12 | HIncludeTarget(INCLUDE_TARGET) 13 | PsiElement(QUOTED_STRING)('"stuff"') 14 | PsiErrorElement:expected ')' 15 | 16 | -------------------------------------------------------------------------------- /testdata/parser/expectedSubRbrace.test: -------------------------------------------------------------------------------- 1 | a = ${path 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HObjectField(OBJECT_FIELD) 6 | HValuedField(VALUED_FIELD) 7 | HFieldKey(FIELD_KEY) 8 | HKeyPart(KEY_PART) 9 | HUnquotedString(UNQUOTED_STRING) 10 | PsiElement(UNQUOTED_CHARS)('a') 11 | PsiWhiteSpace(' ') 12 | PsiElement(EQUALS)('=') 13 | PsiWhiteSpace(' ') 14 | HSubstitution(SUBSTITUTION) 15 | PsiElement(DOLLAR)('$') 16 | PsiElement(SUB_LBRACE)('{') 17 | HPath(PATH) 18 | HSubstitutionKey(SUBSTITUTION_KEY) 19 | HKeyPart(KEY_PART) 20 | HUnquotedString(UNQUOTED_STRING) 21 | PsiElement(UNQUOTED_CHARS)('path') 22 | PsiErrorElement:expected '}' 23 | 24 | -------------------------------------------------------------------------------- /testdata/parser/fieldSeparators.test: -------------------------------------------------------------------------------- 1 | { 2 | key = value 3 | key = value, 4 | key = value, key = value 5 | } 6 | ----- 7 | HOCON_FILE 8 | HObject(OBJECT) 9 | PsiElement(LBRACE)('{') 10 | HObjectEntries(OBJECT_ENTRIES) 11 | PsiWhiteSpace('\n ') 12 | HObjectField(OBJECT_FIELD) 13 | HValuedField(VALUED_FIELD) 14 | HFieldKey(FIELD_KEY) 15 | HKeyPart(KEY_PART) 16 | HUnquotedString(UNQUOTED_STRING) 17 | PsiElement(UNQUOTED_CHARS)('key') 18 | PsiWhiteSpace(' ') 19 | PsiElement(EQUALS)('=') 20 | PsiWhiteSpace(' ') 21 | HStringValue(STRING_VALUE) 22 | HUnquotedString(UNQUOTED_STRING) 23 | PsiElement(UNQUOTED_CHARS)('value') 24 | PsiWhiteSpace('\n ') 25 | HObjectField(OBJECT_FIELD) 26 | HValuedField(VALUED_FIELD) 27 | HFieldKey(FIELD_KEY) 28 | HKeyPart(KEY_PART) 29 | HUnquotedString(UNQUOTED_STRING) 30 | PsiElement(UNQUOTED_CHARS)('key') 31 | PsiWhiteSpace(' ') 32 | PsiElement(EQUALS)('=') 33 | PsiWhiteSpace(' ') 34 | HStringValue(STRING_VALUE) 35 | HUnquotedString(UNQUOTED_STRING) 36 | PsiElement(UNQUOTED_CHARS)('value') 37 | PsiElement(COMMA)(',') 38 | PsiWhiteSpace('\n ') 39 | HObjectField(OBJECT_FIELD) 40 | HValuedField(VALUED_FIELD) 41 | HFieldKey(FIELD_KEY) 42 | HKeyPart(KEY_PART) 43 | HUnquotedString(UNQUOTED_STRING) 44 | PsiElement(UNQUOTED_CHARS)('key') 45 | PsiWhiteSpace(' ') 46 | PsiElement(EQUALS)('=') 47 | PsiWhiteSpace(' ') 48 | HStringValue(STRING_VALUE) 49 | HUnquotedString(UNQUOTED_STRING) 50 | PsiElement(UNQUOTED_CHARS)('value') 51 | PsiElement(COMMA)(',') 52 | PsiWhiteSpace(' ') 53 | HObjectField(OBJECT_FIELD) 54 | HValuedField(VALUED_FIELD) 55 | HFieldKey(FIELD_KEY) 56 | HKeyPart(KEY_PART) 57 | HUnquotedString(UNQUOTED_STRING) 58 | PsiElement(UNQUOTED_CHARS)('key') 59 | PsiWhiteSpace(' ') 60 | PsiElement(EQUALS)('=') 61 | PsiWhiteSpace(' ') 62 | HStringValue(STRING_VALUE) 63 | HUnquotedString(UNQUOTED_STRING) 64 | PsiElement(UNQUOTED_CHARS)('value') 65 | PsiWhiteSpace('\n') 66 | PsiElement(RBRACE)('}') 67 | -------------------------------------------------------------------------------- /testdata/parser/includeModifierBadSpace.test: -------------------------------------------------------------------------------- 1 | include required ("sth") 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HInclude(INCLUDE) 6 | PsiElement(UNQUOTED_CHARS)('include') 7 | PsiWhiteSpace(' ') 8 | HIncluded(INCLUDED) 9 | PsiElement(UNQUOTED_CHARS)('required') 10 | PsiWhiteSpace(' ') 11 | PsiErrorElement:expected '(' immediately after 'required' 12 | PsiElement(LPAREN)('(') 13 | PsiElement(QUOTED_STRING)('"sth"') 14 | PsiElement(RPAREN)(')') 15 | -------------------------------------------------------------------------------- /testdata/parser/keyWhitespaceBinding.test: -------------------------------------------------------------------------------- 1 | something . more . last = 1 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | PsiWhiteSpace(' ') 6 | HObjectField(OBJECT_FIELD) 7 | HPrefixedField(PREFIXED_FIELD) 8 | HFieldKey(FIELD_KEY) 9 | HKeyPart(KEY_PART) 10 | HUnquotedString(UNQUOTED_STRING) 11 | PsiElement(UNQUOTED_CHARS)('something') 12 | PsiWhiteSpace(' ') 13 | PsiElement(PERIOD)('.') 14 | HPrefixedField(PREFIXED_FIELD) 15 | HFieldKey(FIELD_KEY) 16 | HKeyPart(KEY_PART) 17 | HUnquotedString(UNQUOTED_STRING) 18 | PsiWhiteSpace(' ') 19 | PsiElement(UNQUOTED_CHARS)('more') 20 | PsiWhiteSpace(' ') 21 | PsiElement(PERIOD)('.') 22 | HValuedField(VALUED_FIELD) 23 | HFieldKey(FIELD_KEY) 24 | HKeyPart(KEY_PART) 25 | HUnquotedString(UNQUOTED_STRING) 26 | PsiWhiteSpace(' ') 27 | PsiElement(UNQUOTED_CHARS)('last') 28 | PsiWhiteSpace(' ') 29 | PsiElement(EQUALS)('=') 30 | PsiWhiteSpace(' ') 31 | HNumber(NUMBER) 32 | PsiElement(UNQUOTED_CHARS)('1') 33 | -------------------------------------------------------------------------------- /testdata/parser/keyvalues.test: -------------------------------------------------------------------------------- 1 | key = value 2 | kye : vlaue 3 | eyk += eulav 4 | ----- 5 | HOCON_FILE 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HValuedField(VALUED_FIELD) 9 | HFieldKey(FIELD_KEY) 10 | HKeyPart(KEY_PART) 11 | HUnquotedString(UNQUOTED_STRING) 12 | PsiElement(UNQUOTED_CHARS)('key') 13 | PsiWhiteSpace(' ') 14 | PsiElement(EQUALS)('=') 15 | PsiWhiteSpace(' ') 16 | HStringValue(STRING_VALUE) 17 | HUnquotedString(UNQUOTED_STRING) 18 | PsiElement(UNQUOTED_CHARS)('value') 19 | PsiWhiteSpace('\n') 20 | HObjectField(OBJECT_FIELD) 21 | HValuedField(VALUED_FIELD) 22 | HFieldKey(FIELD_KEY) 23 | HKeyPart(KEY_PART) 24 | HUnquotedString(UNQUOTED_STRING) 25 | PsiElement(UNQUOTED_CHARS)('kye') 26 | PsiWhiteSpace(' ') 27 | PsiElement(COLON)(':') 28 | PsiWhiteSpace(' ') 29 | HStringValue(STRING_VALUE) 30 | HUnquotedString(UNQUOTED_STRING) 31 | PsiElement(UNQUOTED_CHARS)('vlaue') 32 | PsiWhiteSpace('\n') 33 | HObjectField(OBJECT_FIELD) 34 | HValuedField(VALUED_FIELD) 35 | HFieldKey(FIELD_KEY) 36 | HKeyPart(KEY_PART) 37 | HUnquotedString(UNQUOTED_STRING) 38 | PsiElement(UNQUOTED_CHARS)('eyk') 39 | PsiWhiteSpace(' ') 40 | PsiElement(PLUS_EQUALS)('+=') 41 | PsiWhiteSpace(' ') 42 | HStringValue(STRING_VALUE) 43 | HUnquotedString(UNQUOTED_STRING) 44 | PsiElement(UNQUOTED_CHARS)('eulav') 45 | -------------------------------------------------------------------------------- /testdata/parser/malformedUrl.test: -------------------------------------------------------------------------------- 1 | include url("unknownProtocol") 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HInclude(INCLUDE) 6 | PsiElement(UNQUOTED_CHARS)('include') 7 | PsiWhiteSpace(' ') 8 | HIncluded(INCLUDED) 9 | HQualifiedIncluded(QUALIFIED_INCLUDED) 10 | PsiElement(UNQUOTED_CHARS)('url') 11 | PsiElement(LPAREN)('(') 12 | PsiErrorElement:no protocol: unknownProtocol 13 | PsiElement(QUOTED_STRING)('"unknownProtocol"') 14 | PsiElement(RPAREN)(')') 15 | -------------------------------------------------------------------------------- /testdata/parser/multilineInclude.test: -------------------------------------------------------------------------------- 1 | include 2 | 3 | file( 4 | "stuff" 5 | ) 6 | ----- 7 | HOCON_FILE 8 | HObjectEntries(OBJECT_ENTRIES) 9 | HInclude(INCLUDE) 10 | PsiElement(UNQUOTED_CHARS)('include') 11 | PsiWhiteSpace('\n\n') 12 | HIncluded(INCLUDED) 13 | HQualifiedIncluded(QUALIFIED_INCLUDED) 14 | PsiElement(UNQUOTED_CHARS)('file') 15 | PsiElement(LPAREN)('(') 16 | PsiWhiteSpace('\n') 17 | HIncludeTarget(INCLUDE_TARGET) 18 | PsiElement(QUOTED_STRING)('"stuff"') 19 | PsiWhiteSpace('\n') 20 | PsiElement(RPAREN)(')') 21 | -------------------------------------------------------------------------------- /testdata/parser/multilineKeyValue.test: -------------------------------------------------------------------------------- 1 | a = 2 | b 3 | a 4 | 5 | = 6 | 7 | 1 8 | ----- 9 | HOCON_FILE 10 | HObjectEntries(OBJECT_ENTRIES) 11 | HObjectField(OBJECT_FIELD) 12 | HValuedField(VALUED_FIELD) 13 | HFieldKey(FIELD_KEY) 14 | HKeyPart(KEY_PART) 15 | HUnquotedString(UNQUOTED_STRING) 16 | PsiElement(UNQUOTED_CHARS)('a') 17 | PsiWhiteSpace(' ') 18 | PsiElement(EQUALS)('=') 19 | PsiWhiteSpace('\n ') 20 | HStringValue(STRING_VALUE) 21 | HUnquotedString(UNQUOTED_STRING) 22 | PsiElement(UNQUOTED_CHARS)('b') 23 | PsiWhiteSpace('\n') 24 | HObjectField(OBJECT_FIELD) 25 | HValuedField(VALUED_FIELD) 26 | HFieldKey(FIELD_KEY) 27 | HKeyPart(KEY_PART) 28 | HUnquotedString(UNQUOTED_STRING) 29 | PsiElement(UNQUOTED_CHARS)('a') 30 | PsiWhiteSpace('\n\n') 31 | PsiElement(EQUALS)('=') 32 | PsiWhiteSpace('\n\n') 33 | HNumber(NUMBER) 34 | PsiElement(UNQUOTED_CHARS)('1') 35 | -------------------------------------------------------------------------------- /testdata/parser/multipleDotsInPath.test: -------------------------------------------------------------------------------- 1 | .a = 1 2 | a..a = 1 3 | a. = 1 4 | ----- 5 | HOCON_FILE 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HPrefixedField(PREFIXED_FIELD) 9 | PsiErrorElement:expected key (use quoted "" if you want empty key) 10 | 11 | PsiElement(PERIOD)('.') 12 | HValuedField(VALUED_FIELD) 13 | HFieldKey(FIELD_KEY) 14 | HKeyPart(KEY_PART) 15 | HUnquotedString(UNQUOTED_STRING) 16 | PsiElement(UNQUOTED_CHARS)('a') 17 | PsiWhiteSpace(' ') 18 | PsiElement(EQUALS)('=') 19 | PsiWhiteSpace(' ') 20 | HNumber(NUMBER) 21 | PsiElement(UNQUOTED_CHARS)('1') 22 | PsiWhiteSpace('\n') 23 | HObjectField(OBJECT_FIELD) 24 | HPrefixedField(PREFIXED_FIELD) 25 | HFieldKey(FIELD_KEY) 26 | HKeyPart(KEY_PART) 27 | HUnquotedString(UNQUOTED_STRING) 28 | PsiElement(UNQUOTED_CHARS)('a') 29 | PsiElement(PERIOD)('.') 30 | HPrefixedField(PREFIXED_FIELD) 31 | PsiErrorElement:expected key (use quoted "" if you want empty key) 32 | 33 | PsiElement(PERIOD)('.') 34 | HValuedField(VALUED_FIELD) 35 | HFieldKey(FIELD_KEY) 36 | HKeyPart(KEY_PART) 37 | HUnquotedString(UNQUOTED_STRING) 38 | PsiElement(UNQUOTED_CHARS)('a') 39 | PsiWhiteSpace(' ') 40 | PsiElement(EQUALS)('=') 41 | PsiWhiteSpace(' ') 42 | HNumber(NUMBER) 43 | PsiElement(UNQUOTED_CHARS)('1') 44 | PsiWhiteSpace('\n') 45 | HObjectField(OBJECT_FIELD) 46 | HPrefixedField(PREFIXED_FIELD) 47 | HFieldKey(FIELD_KEY) 48 | HKeyPart(KEY_PART) 49 | HUnquotedString(UNQUOTED_STRING) 50 | PsiElement(UNQUOTED_CHARS)('a') 51 | PsiElement(PERIOD)('.') 52 | HValuedField(VALUED_FIELD) 53 | PsiErrorElement:expected key (use quoted "" if you want empty key) 54 | 55 | PsiWhiteSpace(' ') 56 | PsiElement(EQUALS)('=') 57 | PsiWhiteSpace(' ') 58 | HNumber(NUMBER) 59 | PsiElement(UNQUOTED_CHARS)('1') 60 | -------------------------------------------------------------------------------- /testdata/parser/nullValue.test: -------------------------------------------------------------------------------- 1 | key = null 2 | key = null ...not 3 | key = not null 4 | ----- 5 | HOCON_FILE 6 | HObjectEntries(OBJECT_ENTRIES) 7 | HObjectField(OBJECT_FIELD) 8 | HValuedField(VALUED_FIELD) 9 | HFieldKey(FIELD_KEY) 10 | HKeyPart(KEY_PART) 11 | HUnquotedString(UNQUOTED_STRING) 12 | PsiElement(UNQUOTED_CHARS)('key') 13 | PsiWhiteSpace(' ') 14 | PsiElement(EQUALS)('=') 15 | PsiWhiteSpace(' ') 16 | HNull(NULL) 17 | PsiElement(UNQUOTED_CHARS)('null') 18 | PsiWhiteSpace('\n') 19 | HObjectField(OBJECT_FIELD) 20 | HValuedField(VALUED_FIELD) 21 | HFieldKey(FIELD_KEY) 22 | HKeyPart(KEY_PART) 23 | HUnquotedString(UNQUOTED_STRING) 24 | PsiElement(UNQUOTED_CHARS)('key') 25 | PsiWhiteSpace(' ') 26 | PsiElement(EQUALS)('=') 27 | PsiWhiteSpace(' ') 28 | HStringValue(STRING_VALUE) 29 | HUnquotedString(UNQUOTED_STRING) 30 | PsiElement(UNQUOTED_CHARS)('null') 31 | PsiWhiteSpace(' ') 32 | PsiElement(PERIOD)('.') 33 | PsiElement(PERIOD)('.') 34 | PsiElement(PERIOD)('.') 35 | PsiElement(UNQUOTED_CHARS)('not') 36 | PsiWhiteSpace('\n') 37 | HObjectField(OBJECT_FIELD) 38 | HValuedField(VALUED_FIELD) 39 | HFieldKey(FIELD_KEY) 40 | HKeyPart(KEY_PART) 41 | HUnquotedString(UNQUOTED_STRING) 42 | PsiElement(UNQUOTED_CHARS)('key') 43 | PsiWhiteSpace(' ') 44 | PsiElement(EQUALS)('=') 45 | PsiWhiteSpace(' ') 46 | HStringValue(STRING_VALUE) 47 | HUnquotedString(UNQUOTED_STRING) 48 | PsiElement(UNQUOTED_CHARS)('not') 49 | PsiWhiteSpace(' ') 50 | PsiElement(UNQUOTED_CHARS)('null') 51 | -------------------------------------------------------------------------------- /testdata/parser/objectEntriesGreedyBinding.test: -------------------------------------------------------------------------------- 1 | obj { 2 | 3 | # comment 4 | // comment 5 | 6 | key = value 7 | 8 | # comment 9 | 10 | 11 | } 12 | ----- 13 | HOCON_FILE 14 | HObjectEntries(OBJECT_ENTRIES) 15 | HObjectField(OBJECT_FIELD) 16 | HValuedField(VALUED_FIELD) 17 | HFieldKey(FIELD_KEY) 18 | HKeyPart(KEY_PART) 19 | HUnquotedString(UNQUOTED_STRING) 20 | PsiElement(UNQUOTED_CHARS)('obj') 21 | PsiWhiteSpace(' ') 22 | HObject(OBJECT) 23 | PsiElement(LBRACE)('{') 24 | HObjectEntries(OBJECT_ENTRIES) 25 | PsiWhiteSpace('\n\n ') 26 | PsiComment(HASH_COMMENT)('# comment') 27 | PsiWhiteSpace('\n ') 28 | PsiComment(DOUBLE_SLASH_COMMENT)('// comment') 29 | PsiWhiteSpace('\n\n ') 30 | HObjectField(OBJECT_FIELD) 31 | HValuedField(VALUED_FIELD) 32 | HFieldKey(FIELD_KEY) 33 | HKeyPart(KEY_PART) 34 | HUnquotedString(UNQUOTED_STRING) 35 | PsiElement(UNQUOTED_CHARS)('key') 36 | PsiWhiteSpace(' ') 37 | PsiElement(EQUALS)('=') 38 | PsiWhiteSpace(' ') 39 | HStringValue(STRING_VALUE) 40 | HUnquotedString(UNQUOTED_STRING) 41 | PsiElement(UNQUOTED_CHARS)('value') 42 | PsiWhiteSpace('\n\n ') 43 | PsiComment(HASH_COMMENT)('# comment') 44 | PsiWhiteSpace('\n\n\n') 45 | PsiElement(RBRACE)('}') 46 | -------------------------------------------------------------------------------- /testdata/parser/objects.test: -------------------------------------------------------------------------------- 1 | obj { 2 | key = value 3 | obj = { 4 | key = value 5 | } 6 | } 7 | ----- 8 | HOCON_FILE 9 | HObjectEntries(OBJECT_ENTRIES) 10 | HObjectField(OBJECT_FIELD) 11 | HValuedField(VALUED_FIELD) 12 | HFieldKey(FIELD_KEY) 13 | HKeyPart(KEY_PART) 14 | HUnquotedString(UNQUOTED_STRING) 15 | PsiElement(UNQUOTED_CHARS)('obj') 16 | PsiWhiteSpace(' ') 17 | HObject(OBJECT) 18 | PsiElement(LBRACE)('{') 19 | HObjectEntries(OBJECT_ENTRIES) 20 | PsiWhiteSpace('\n ') 21 | HObjectField(OBJECT_FIELD) 22 | HValuedField(VALUED_FIELD) 23 | HFieldKey(FIELD_KEY) 24 | HKeyPart(KEY_PART) 25 | HUnquotedString(UNQUOTED_STRING) 26 | PsiElement(UNQUOTED_CHARS)('key') 27 | PsiWhiteSpace(' ') 28 | PsiElement(EQUALS)('=') 29 | PsiWhiteSpace(' ') 30 | HStringValue(STRING_VALUE) 31 | HUnquotedString(UNQUOTED_STRING) 32 | PsiElement(UNQUOTED_CHARS)('value') 33 | PsiWhiteSpace('\n ') 34 | HObjectField(OBJECT_FIELD) 35 | HValuedField(VALUED_FIELD) 36 | HFieldKey(FIELD_KEY) 37 | HKeyPart(KEY_PART) 38 | HUnquotedString(UNQUOTED_STRING) 39 | PsiElement(UNQUOTED_CHARS)('obj') 40 | PsiWhiteSpace(' ') 41 | PsiElement(EQUALS)('=') 42 | PsiWhiteSpace(' ') 43 | HObject(OBJECT) 44 | PsiElement(LBRACE)('{') 45 | HObjectEntries(OBJECT_ENTRIES) 46 | PsiWhiteSpace('\n ') 47 | HObjectField(OBJECT_FIELD) 48 | HValuedField(VALUED_FIELD) 49 | HFieldKey(FIELD_KEY) 50 | HKeyPart(KEY_PART) 51 | HUnquotedString(UNQUOTED_STRING) 52 | PsiElement(UNQUOTED_CHARS)('key') 53 | PsiWhiteSpace(' ') 54 | PsiElement(EQUALS)('=') 55 | PsiWhiteSpace(' ') 56 | HStringValue(STRING_VALUE) 57 | HUnquotedString(UNQUOTED_STRING) 58 | PsiElement(UNQUOTED_CHARS)('value') 59 | PsiWhiteSpace('\n ') 60 | PsiElement(RBRACE)('}') 61 | PsiWhiteSpace('\n') 62 | PsiElement(RBRACE)('}') 63 | -------------------------------------------------------------------------------- /testdata/parser/path.test: -------------------------------------------------------------------------------- 1 | stuff.more"concat"more"""multi 2 | line"""."".moar=42 3 | ----- 4 | HOCON_FILE 5 | HObjectEntries(OBJECT_ENTRIES) 6 | HObjectField(OBJECT_FIELD) 7 | HPrefixedField(PREFIXED_FIELD) 8 | HFieldKey(FIELD_KEY) 9 | HKeyPart(KEY_PART) 10 | HUnquotedString(UNQUOTED_STRING) 11 | PsiElement(UNQUOTED_CHARS)('stuff') 12 | PsiElement(PERIOD)('.') 13 | HPrefixedField(PREFIXED_FIELD) 14 | HFieldKey(FIELD_KEY) 15 | HKeyPart(KEY_PART) 16 | HUnquotedString(UNQUOTED_STRING) 17 | PsiElement(UNQUOTED_CHARS)('more') 18 | HKeyPart(KEY_PART) 19 | PsiElement(QUOTED_STRING)('"concat"') 20 | HKeyPart(KEY_PART) 21 | HUnquotedString(UNQUOTED_STRING) 22 | PsiElement(UNQUOTED_CHARS)('more') 23 | HKeyPart(KEY_PART) 24 | PsiElement(MULTILINE_STRING)('"""multi\nline"""') 25 | PsiElement(PERIOD)('.') 26 | HPrefixedField(PREFIXED_FIELD) 27 | HFieldKey(FIELD_KEY) 28 | HKeyPart(KEY_PART) 29 | PsiElement(QUOTED_STRING)('""') 30 | PsiElement(PERIOD)('.') 31 | HValuedField(VALUED_FIELD) 32 | HFieldKey(FIELD_KEY) 33 | HKeyPart(KEY_PART) 34 | HUnquotedString(UNQUOTED_STRING) 35 | PsiElement(UNQUOTED_CHARS)('moar') 36 | PsiElement(EQUALS)('=') 37 | HNumber(NUMBER) 38 | PsiElement(UNQUOTED_CHARS)('42') 39 | -------------------------------------------------------------------------------- /testdata/parser/stringconcat.test: -------------------------------------------------------------------------------- 1 | key = stuff"more stuff" even (more) stuff """ multiline 2 | stuff """ some.more.stuff "quoted stuff" 3 | ----- 4 | HOCON_FILE 5 | HObjectEntries(OBJECT_ENTRIES) 6 | HObjectField(OBJECT_FIELD) 7 | HValuedField(VALUED_FIELD) 8 | HFieldKey(FIELD_KEY) 9 | HKeyPart(KEY_PART) 10 | HUnquotedString(UNQUOTED_STRING) 11 | PsiElement(UNQUOTED_CHARS)('key') 12 | PsiWhiteSpace(' ') 13 | PsiElement(EQUALS)('=') 14 | PsiWhiteSpace(' ') 15 | HConcatenation(CONCATENATION) 16 | HStringValue(STRING_VALUE) 17 | HUnquotedString(UNQUOTED_STRING) 18 | PsiElement(UNQUOTED_CHARS)('stuff') 19 | HStringValue(STRING_VALUE) 20 | PsiElement(QUOTED_STRING)('"more stuff"') 21 | HStringValue(STRING_VALUE) 22 | HUnquotedString(UNQUOTED_STRING) 23 | PsiWhiteSpace(' ') 24 | PsiElement(UNQUOTED_CHARS)('even') 25 | PsiWhiteSpace(' ') 26 | PsiElement(LPAREN)('(') 27 | PsiElement(UNQUOTED_CHARS)('more') 28 | PsiElement(RPAREN)(')') 29 | PsiWhiteSpace(' ') 30 | PsiElement(UNQUOTED_CHARS)('stuff') 31 | PsiWhiteSpace(' ') 32 | HStringValue(STRING_VALUE) 33 | PsiElement(MULTILINE_STRING)('""" multiline\nstuff """') 34 | HStringValue(STRING_VALUE) 35 | HUnquotedString(UNQUOTED_STRING) 36 | PsiWhiteSpace(' ') 37 | PsiElement(UNQUOTED_CHARS)('some') 38 | PsiElement(PERIOD)('.') 39 | PsiElement(UNQUOTED_CHARS)('more') 40 | PsiElement(PERIOD)('.') 41 | PsiElement(UNQUOTED_CHARS)('stuff') 42 | PsiWhiteSpace(' ') 43 | HStringValue(STRING_VALUE) 44 | PsiElement(QUOTED_STRING)('"quoted stuff"') 45 | -------------------------------------------------------------------------------- /testdata/parser/toplevelArray.test: -------------------------------------------------------------------------------- 1 | [1,2,3] 2 | ----- 3 | HOCON_FILE 4 | HArray(ARRAY) 5 | PsiElement(LBRACKET)('[') 6 | HNumber(NUMBER) 7 | PsiElement(UNQUOTED_CHARS)('1') 8 | PsiElement(COMMA)(',') 9 | HNumber(NUMBER) 10 | PsiElement(UNQUOTED_CHARS)('2') 11 | PsiElement(COMMA)(',') 12 | HNumber(NUMBER) 13 | PsiElement(UNQUOTED_CHARS)('3') 14 | PsiElement(RBRACKET)(']') 15 | -------------------------------------------------------------------------------- /testdata/parser/toplevelObject.test: -------------------------------------------------------------------------------- 1 | { 2 | key = value 3 | kye : vlaue 4 | } 5 | ----- 6 | HOCON_FILE 7 | HObject(OBJECT) 8 | PsiElement(LBRACE)('{') 9 | HObjectEntries(OBJECT_ENTRIES) 10 | PsiWhiteSpace('\n ') 11 | HObjectField(OBJECT_FIELD) 12 | HValuedField(VALUED_FIELD) 13 | HFieldKey(FIELD_KEY) 14 | HKeyPart(KEY_PART) 15 | HUnquotedString(UNQUOTED_STRING) 16 | PsiElement(UNQUOTED_CHARS)('key') 17 | PsiWhiteSpace(' ') 18 | PsiElement(EQUALS)('=') 19 | PsiWhiteSpace(' ') 20 | HStringValue(STRING_VALUE) 21 | HUnquotedString(UNQUOTED_STRING) 22 | PsiElement(UNQUOTED_CHARS)('value') 23 | PsiWhiteSpace('\n ') 24 | HObjectField(OBJECT_FIELD) 25 | HValuedField(VALUED_FIELD) 26 | HFieldKey(FIELD_KEY) 27 | HKeyPart(KEY_PART) 28 | HUnquotedString(UNQUOTED_STRING) 29 | PsiElement(UNQUOTED_CHARS)('kye') 30 | PsiWhiteSpace(' ') 31 | PsiElement(COLON)(':') 32 | PsiWhiteSpace(' ') 33 | HStringValue(STRING_VALUE) 34 | HUnquotedString(UNQUOTED_STRING) 35 | PsiElement(UNQUOTED_CHARS)('vlaue') 36 | PsiWhiteSpace('\n') 37 | PsiElement(RBRACE)('}') 38 | -------------------------------------------------------------------------------- /testdata/parser/unclosedMultilineString.test: -------------------------------------------------------------------------------- 1 | a = """unclosed 2 | multiline 3 | ----- 4 | HOCON_FILE 5 | HObjectEntries(OBJECT_ENTRIES) 6 | HObjectField(OBJECT_FIELD) 7 | HValuedField(VALUED_FIELD) 8 | HFieldKey(FIELD_KEY) 9 | HKeyPart(KEY_PART) 10 | HUnquotedString(UNQUOTED_STRING) 11 | PsiElement(UNQUOTED_CHARS)('a') 12 | PsiWhiteSpace(' ') 13 | PsiElement(EQUALS)('=') 14 | PsiWhiteSpace(' ') 15 | HStringValue(STRING_VALUE) 16 | PsiElement(MULTILINE_STRING)('"""unclosed\nmultiline') 17 | PsiErrorElement:unclosed multiline string 18 | 19 | -------------------------------------------------------------------------------- /testdata/parser/unclosedQuotedString.test: -------------------------------------------------------------------------------- 1 | a = "unclosed quoted 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HObjectField(OBJECT_FIELD) 6 | HValuedField(VALUED_FIELD) 7 | HFieldKey(FIELD_KEY) 8 | HKeyPart(KEY_PART) 9 | HUnquotedString(UNQUOTED_STRING) 10 | PsiElement(UNQUOTED_CHARS)('a') 11 | PsiWhiteSpace(' ') 12 | PsiElement(EQUALS)('=') 13 | PsiWhiteSpace(' ') 14 | HStringValue(STRING_VALUE) 15 | PsiElement(QUOTED_STRING)('"unclosed quoted') 16 | PsiErrorElement:unclosed quoted string 17 | 18 | -------------------------------------------------------------------------------- /testdata/parser/unexpectedTokenAfterValue.test: -------------------------------------------------------------------------------- 1 | a {} moar 2 | ----- 3 | HOCON_FILE 4 | HObjectEntries(OBJECT_ENTRIES) 5 | HObjectField(OBJECT_FIELD) 6 | HValuedField(VALUED_FIELD) 7 | HFieldKey(FIELD_KEY) 8 | HKeyPart(KEY_PART) 9 | HUnquotedString(UNQUOTED_STRING) 10 | PsiElement(UNQUOTED_CHARS)('a') 11 | PsiWhiteSpace(' ') 12 | HObject(OBJECT) 13 | PsiElement(LBRACE)('{') 14 | HObjectEntries(OBJECT_ENTRIES) 15 | 16 | PsiElement(RBRACE)('}') 17 | PsiWhiteSpace(' ') 18 | PsiErrorElement:unexpected token 19 | PsiElement(UNQUOTED_CHARS)('moar') 20 | -------------------------------------------------------------------------------- /testdata/parser/unquotedInclude.test: -------------------------------------------------------------------------------- 1 | notInclude = include "stuff" 2 | alsoNotInclude = [1, include "stuff"] 3 | ----- 4 | HOCON_FILE 5 | HObjectEntries(OBJECT_ENTRIES) 6 | HObjectField(OBJECT_FIELD) 7 | HValuedField(VALUED_FIELD) 8 | HFieldKey(FIELD_KEY) 9 | HKeyPart(KEY_PART) 10 | HUnquotedString(UNQUOTED_STRING) 11 | PsiElement(UNQUOTED_CHARS)('notInclude') 12 | PsiWhiteSpace(' ') 13 | PsiElement(EQUALS)('=') 14 | PsiWhiteSpace(' ') 15 | HConcatenation(CONCATENATION) 16 | HStringValue(STRING_VALUE) 17 | HUnquotedString(UNQUOTED_STRING) 18 | PsiElement(UNQUOTED_CHARS)('include') 19 | PsiWhiteSpace(' ') 20 | HStringValue(STRING_VALUE) 21 | PsiElement(QUOTED_STRING)('"stuff"') 22 | PsiWhiteSpace('\n') 23 | HObjectField(OBJECT_FIELD) 24 | HValuedField(VALUED_FIELD) 25 | HFieldKey(FIELD_KEY) 26 | HKeyPart(KEY_PART) 27 | HUnquotedString(UNQUOTED_STRING) 28 | PsiElement(UNQUOTED_CHARS)('alsoNotInclude') 29 | PsiWhiteSpace(' ') 30 | PsiElement(EQUALS)('=') 31 | PsiWhiteSpace(' ') 32 | HArray(ARRAY) 33 | PsiElement(LBRACKET)('[') 34 | HNumber(NUMBER) 35 | PsiElement(UNQUOTED_CHARS)('1') 36 | PsiElement(COMMA)(',') 37 | PsiWhiteSpace(' ') 38 | HConcatenation(CONCATENATION) 39 | HStringValue(STRING_VALUE) 40 | HUnquotedString(UNQUOTED_STRING) 41 | PsiElement(UNQUOTED_CHARS)('include') 42 | PsiWhiteSpace(' ') 43 | HStringValue(STRING_VALUE) 44 | PsiElement(QUOTED_STRING)('"stuff"') 45 | PsiElement(RBRACKET)(']') 46 | -------------------------------------------------------------------------------- /testdata/resolution/application.conf: -------------------------------------------------------------------------------- 1 | a.b.c = 1 2 | a.b.x.c = 1 3 | 4 | // self-referentials 5 | a.b = {c = 1} ${a.b} ${a.b.x} 6 | 7 | a { 8 | b.c = 2 9 | b = {c = 3} {c = 4} 10 | } 11 | 12 | a.b = ${other} { 13 | c = 6 14 | } 15 | 16 | other { 17 | c = 5 18 | } 19 | 20 | include "included" 21 | 22 | a.incsub.c = 11 // fixup include 23 | incsub.fallback.c = 12 // fallback for fixup include 24 | 25 | a = { 26 | include "nestedIncluded.conf" 27 | } { 28 | b.c = 13 29 | } 30 | 31 | a.b.c = 14 32 | 33 | a.b.x.c = 2 -------------------------------------------------------------------------------- /testdata/resolution/included.conf: -------------------------------------------------------------------------------- 1 | a.b.c = 7 2 | include "moreIncluded" 3 | a.b.c = 9 4 | -------------------------------------------------------------------------------- /testdata/resolution/moreIncluded.conf: -------------------------------------------------------------------------------- 1 | a.b.c = 8 2 | 3 | // include cycles 4 | include "application.conf" 5 | include "included.conf" 6 | -------------------------------------------------------------------------------- /testdata/resolution/nestedIncluded.conf: -------------------------------------------------------------------------------- 1 | b.c = 10 2 | b = ${incsub} 3 | b = ${incsub.fallback} -------------------------------------------------------------------------------- /testdata/resolution/reference.conf: -------------------------------------------------------------------------------- 1 | a.b.c = 0 --------------------------------------------------------------------------------