├── .github └── workflows │ └── gradle.yml ├── .gitignore ├── LICENSE ├── README.md ├── build.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle.kts └── src ├── main ├── grammars │ ├── ArendDocLexer.flex │ ├── ArendLexer.flex │ └── ArendParser.bnf ├── html │ ├── Arend.css │ ├── change-notes.html │ ├── description.html │ └── highlight-hover.js ├── java │ └── org │ │ └── arend │ │ ├── ArendLanguage.java │ │ ├── InjectionTextLanguage.java │ │ └── parser │ │ ├── ParserMixin.java │ │ └── ParserUtil.java ├── kotlin │ └── org │ │ └── arend │ │ ├── ArendBraceMatcher.kt │ │ ├── ArendFileType.kt │ │ ├── ArendIcons.kt │ │ ├── ArendImplementationTextSelectioner.kt │ │ ├── ArendStartupActivity.kt │ │ ├── IArendFile.kt │ │ ├── actions │ │ ├── ArendActions.kt │ │ ├── ArendCreateFileAction.kt │ │ ├── ArendExtendWordSelectionHandler.kt │ │ ├── ArendGotoNextErrorAction.kt │ │ ├── ArendNormalizeToggleAction.kt │ │ ├── ArendOpenInReplAction.kt │ │ ├── ArendPopupAction.kt │ │ ├── ArendShowNormalFormAction.kt │ │ ├── ArendShowTypeAction.kt │ │ ├── ArendToolbarGroup.kt │ │ ├── GotoArendFileAction.kt │ │ ├── SearchArendFilesContributor.kt │ │ └── mark │ │ │ ├── ArendMarkActionUtils.kt │ │ │ ├── ArendMarkBinRootAction.kt │ │ │ ├── ArendMarkExcludeRootAction.kt │ │ │ ├── ArendMarkResourceRootAction.kt │ │ │ ├── ArendMarkResourceTestRootAction.kt │ │ │ ├── ArendMarkSourceRootAction.kt │ │ │ ├── ArendMarkTestSourceRootAction.kt │ │ │ └── ArendUnmarkRootAction.kt │ │ ├── annotation │ │ └── ArendHighlightRangeExtension.kt │ │ ├── codeInsight │ │ ├── ArendCharFilter.kt │ │ ├── ArendCodeInsightUtils.kt │ │ ├── ArendDeclarationRangeHandler.kt │ │ ├── ArendImportOptimizer.kt │ │ ├── ArendLineMarkerProvider.kt │ │ ├── ArendParameterInfoHandler.kt │ │ ├── ArendPopupHandler.kt │ │ ├── ArendStringQuoteHandler.kt │ │ ├── ArendTypedHandler.kt │ │ ├── ParameterDescriptor.kt │ │ ├── completion │ │ │ ├── ArendCompletionConfidence.kt │ │ │ ├── ArendCompletionContributor.kt │ │ │ ├── ArendNoVariantsDelegator.kt │ │ │ ├── ArendPatterns.kt │ │ │ ├── Constants.kt │ │ │ └── ReplaceInsertHandler.kt │ │ └── hints │ │ │ ├── ArendAxiomsInlayProvider.kt │ │ │ ├── ArendDefinitionInlayProvider.kt │ │ │ ├── ArendGoalsInlayProvider.kt │ │ │ └── ArendParametersInlayProvider.kt │ │ ├── commenter │ │ └── ArendCommenter.kt │ │ ├── debug │ │ ├── ArendDebuggerRunner.kt │ │ └── ArendPositionManagerFactory.kt │ │ ├── documentation │ │ ├── ArendDocumentationCommentUtil.kt │ │ ├── ArendDocumentationKeywordUtil.kt │ │ ├── ArendDocumentationLatexUtil.kt │ │ ├── ArendDocumentationLibHtmlUtil.kt │ │ ├── ArendDocumentationProvider.kt │ │ ├── ArendDocumentationUtil.kt │ │ └── GenerateArendLibHtmlStarter.kt │ │ ├── editor │ │ ├── ArendAutoImportConfigurable.kt │ │ ├── ArendColorSettingsPage.kt │ │ ├── ArendConfigurable.kt │ │ ├── ArendEditorTabColorProvider.kt │ │ ├── ArendSettingsView.kt │ │ └── ArendSmartKeysConfigurable.kt │ │ ├── folding │ │ ├── ArendFoldingBuilder.kt │ │ └── ImportFoldingBuilder.kt │ │ ├── formatting │ │ ├── ArendBackspaceDisabler.kt │ │ ├── ArendCodeStyleImportsPanelWrapper.kt │ │ ├── ArendCodeStyleSettingsProvider.kt │ │ ├── ArendEnterAtIndentHandler.kt │ │ ├── ArendFormattingModelBuilder.kt │ │ └── block │ │ │ ├── AbstractArendBlock.kt │ │ │ ├── ArgumentAppExprBlock.kt │ │ │ ├── CommentPieceBlock.kt │ │ │ ├── GroupBlock.kt │ │ │ └── SimpleArendBlock.kt │ │ ├── graph │ │ └── GraphSimulator.kt │ │ ├── hierarchy │ │ ├── ArendHierarchyNodeDescriptor.kt │ │ ├── call │ │ │ ├── ArendCallHierarchyBrowser.kt │ │ │ ├── ArendCallHierarchyProvider.kt │ │ │ ├── ArendCalleeTreeStructure.kt │ │ │ └── ArendCallerTreeStructure.kt │ │ └── clazz │ │ │ ├── ArendClassHierarchyBrowser.kt │ │ │ ├── ArendClassHierarchyProvider.kt │ │ │ ├── ArendFieldHNodeDescriptor.kt │ │ │ ├── ArendSubClassTreeStructure.kt │ │ │ └── ArendSuperClassTreeStructure.kt │ │ ├── highlight │ │ ├── ArendChangeLocalityDetector.kt │ │ ├── ArendHighlightingColors.kt │ │ ├── ArendHighlightingPass.kt │ │ ├── ArendHighlightingPassFactory.kt │ │ ├── ArendPassFactoryService.kt │ │ ├── ArendProblemHighlightFilter.kt │ │ ├── ArendRainbowVisitor.kt │ │ ├── ArendSyntaxHighlighter.kt │ │ ├── ArendSyntaxHighlighterFactory.kt │ │ ├── ArendTargetElementEvaluator.kt │ │ ├── ArendUnusedImportHighlightingPass.kt │ │ ├── ArendUnusedImportHighlightingPassFactory.kt │ │ ├── BasePass.kt │ │ ├── BasePassFactory.kt │ │ ├── EmptyHighlightingPass.kt │ │ ├── NameShadowingHighlighterPass.kt │ │ ├── NameShadowingHighlighterPassFactory.kt │ │ ├── PartiallyInfixOperatorPrefixFormPass.kt │ │ ├── PartiallyInfixOperatorPrefixFormPassFactory.kt │ │ ├── RedundantParensPass.kt │ │ ├── RedundantParensPassFactory.kt │ │ ├── TypecheckerPass.kt │ │ └── TypecheckerPassFactory.kt │ │ ├── injection │ │ ├── ArendLanguageInjector.kt │ │ ├── CollectingDocStringBuilder.kt │ │ ├── InjectedArendEditor.kt │ │ ├── InjectedEditorActionsUtil.kt │ │ ├── InjectionHighlightingPass.kt │ │ ├── InjectionHighlightingPassFactory.kt │ │ ├── InjectionTextASTFactory.kt │ │ ├── InjectionTextFileElementType.kt │ │ ├── InjectionTextFileType.kt │ │ ├── InjectionTextParserDefinition.kt │ │ ├── PsiInjectionText.kt │ │ ├── PsiInjectionTextDocumentationProvider.kt │ │ ├── PsiInjectionTextFile.kt │ │ ├── TrivialTextEscaper.kt │ │ └── actions │ │ │ ├── HideImplicitInformationAction.kt │ │ │ ├── NormalizationCache.kt │ │ │ ├── RevealImplicitInformationAction.kt │ │ │ ├── RevealingInformationCaretListener.kt │ │ │ ├── RevealingUtils.kt │ │ │ ├── UnblockingDocumentAction.kt │ │ │ └── UndoableConfigModificationAction.kt │ │ ├── inspection │ │ ├── ArendInspectionBase.kt │ │ ├── ArendInspectionConcreteVisitor.kt │ │ ├── ArendInspectionSuppressor.kt │ │ ├── ArendUnusedImportInspection.kt │ │ ├── RedundantParameterInspection.kt │ │ ├── RedundantParensInspection.kt │ │ └── UnresolvedArendPatternInspection.kt │ │ ├── intention │ │ ├── AbstractGenerateFunctionIntention.kt │ │ ├── AddClarifyingParensIntention.kt │ │ ├── ArendIntentionUtils.kt │ │ ├── ArendOptimizeImportsQuickFix.kt │ │ ├── BaseArendIntention.kt │ │ ├── ChangeArgumentExplicitnessIntention.kt │ │ ├── ExtractExpressionToFunctionIntention.kt │ │ ├── GenerateFunctionFromGoalIntention.kt │ │ ├── ImplementFieldsInCoClauseIntention.kt │ │ ├── RemoveClarifyingParensIntention.kt │ │ ├── ReplaceBracketsIntention.kt │ │ ├── ReplaceMetaWithResultIntention.kt │ │ ├── ReplaceWithNormalFormIntention.kt │ │ ├── ReplaceWithShortNameIntention.kt │ │ ├── SelectionIntention.kt │ │ ├── SelfTargetingIntention.kt │ │ ├── SplitAtomPatternIntention.kt │ │ ├── SwapInfixOperatorArgumentsIntention.kt │ │ ├── WrapInGoalIntention.kt │ │ ├── binOp │ │ │ ├── BinOpIntentionUtil.kt │ │ │ ├── BinOpSeqProcessor.kt │ │ │ └── CaretHelper.kt │ │ └── generating │ │ │ ├── CreateLetBindingIntention.kt │ │ │ ├── GenerateElimMissingClausesIntention.kt │ │ │ ├── GenerateMissingClausesIntention.kt │ │ │ ├── GenerateMissingClausesUtils.kt │ │ │ ├── LetWrappingOptionEditorRenderer.kt │ │ │ └── ShrinkAbstractVisitor.kt │ │ ├── lexer │ │ ├── ArendDocLexerAdapter.kt │ │ └── ArendLexerAdapter.kt │ │ ├── liveTemplates │ │ └── ArendTemplateContextType.kt │ │ ├── module │ │ ├── AllArendFilesScope.kt │ │ ├── AllModulesScope.kt │ │ ├── ArendFakeRawSource.kt │ │ ├── ArendLibraryType.kt │ │ ├── ArendModuleBuilder.kt │ │ ├── ArendModuleType.kt │ │ ├── ArendPreludeLibrary.kt │ │ ├── ArendPreludeScope.kt │ │ ├── ArendRawLibrary.kt │ │ ├── ArendRawSource.kt │ │ ├── IntellijBinarySource.kt │ │ ├── IntellijClassLoaderDelegate.kt │ │ ├── ModuleScope.kt │ │ ├── ModuleSynchronizer.kt │ │ ├── ReloadLibrariesAction.kt │ │ ├── UpgradeArendLibrary.kt │ │ ├── config │ │ │ ├── ArendModuleConfigService.kt │ │ │ ├── ArendModuleConfiguration.kt │ │ │ ├── ArendModuleConfigurationUpdater.kt │ │ │ ├── ArendModuleStructureExtension.kt │ │ │ ├── EmptyLibraryConfig.kt │ │ │ ├── ExternalLibraryConfig.kt │ │ │ └── LibraryConfig.kt │ │ ├── editor │ │ │ ├── ArendModuleConfigEditorProvider.kt │ │ │ ├── ArendModuleConfigurationEditor.kt │ │ │ └── ArendModuleConfigurationView.kt │ │ ├── orderRoot │ │ │ ├── ArendConfigOrderRootType.kt │ │ │ ├── ArendConfigOrderRootTypeUIFactory.kt │ │ │ ├── ArendConfigRootDetector.kt │ │ │ └── ArendLibraryRootsComponentDescriptor.kt │ │ └── starter │ │ │ ├── ArendCommonStarterContext.kt │ │ │ ├── ArendCommonStarterInitialStep.kt │ │ │ ├── ArendGeneratorContext.kt │ │ │ ├── ArendStarterInitialStep.kt │ │ │ ├── ArendStarterLibrariesStep.kt │ │ │ ├── ArendStarterModuleBuilder.kt │ │ │ ├── ArendStarterSettings.kt │ │ │ └── ArendStarterUtils.kt │ │ ├── navigation │ │ ├── ArendClassNavigationContributor.kt │ │ ├── ArendFileNavigationContributor.kt │ │ ├── ArendNavBarExtension.kt │ │ ├── ArendNavigationContributorBase.kt │ │ ├── ArendSymbolNavigationContributor.kt │ │ └── Utils.kt │ │ ├── notification │ │ └── FileOutsideSourcesProvider.kt │ │ ├── parser │ │ ├── ArendDocParser.kt │ │ └── ArendParserDefinition.kt │ │ ├── project │ │ ├── ArendPreludeLibraryRootProvider.kt │ │ ├── ArendProjectImportBuilder.kt │ │ ├── ArendProjectImportProvider.kt │ │ ├── ArendProjectOpenProcessor.kt │ │ └── ArendProjectStructureDetector.kt │ │ ├── projectView │ │ └── ArendProjectViewStructureProvider.kt │ │ ├── psi │ │ ├── ArendCompositeElementType.kt │ │ ├── ArendExpressionCodeFragment.kt │ │ ├── ArendFile.kt │ │ ├── ArendFileScope.kt │ │ ├── ArendPsiFactory.kt │ │ ├── ArendTokenType.kt │ │ ├── ClassReferenceHolder.kt │ │ ├── PsiElementUtils.kt │ │ ├── SourceInfoErrorData.kt │ │ ├── doc │ │ │ ├── ArendDocCodeBlock.kt │ │ │ ├── ArendDocComment.kt │ │ │ ├── ArendDocReference.kt │ │ │ └── ArendDocReferenceText.kt │ │ ├── ext │ │ │ ├── ArendAccessMod.kt │ │ │ ├── ArendAlias.kt │ │ │ ├── ArendAppExpr.kt │ │ │ ├── ArendAppPrefix.kt │ │ │ ├── ArendArgument.kt │ │ │ ├── ArendArgumentAppExpr.kt │ │ │ ├── ArendArrExpr.kt │ │ │ ├── ArendAsPattern.kt │ │ │ ├── ArendAtom.kt │ │ │ ├── ArendAtomFieldsAcc.kt │ │ │ ├── ArendAtomLevelExpr.kt │ │ │ ├── ArendAtomOnlyLevelExpr.kt │ │ │ ├── ArendCaseArg.kt │ │ │ ├── ArendCaseExpr.kt │ │ │ ├── ArendClassField.kt │ │ │ ├── ArendClassImplement.kt │ │ │ ├── ArendClassStat.kt │ │ │ ├── ArendClause.kt │ │ │ ├── ArendCoClause.kt │ │ │ ├── ArendCoClauseDef.kt │ │ │ ├── ArendCompositeElement.kt │ │ │ ├── ArendConstructor.kt │ │ │ ├── ArendConstructorClause.kt │ │ │ ├── ArendDataBody.kt │ │ │ ├── ArendDefClass.kt │ │ │ ├── ArendDefData.kt │ │ │ ├── ArendDefFunction.kt │ │ │ ├── ArendDefInstance.kt │ │ │ ├── ArendDefMeta.kt │ │ │ ├── ArendDefModule.kt │ │ │ ├── ArendDefinition.kt │ │ │ ├── ArendElim.kt │ │ │ ├── ArendExpr.kt │ │ │ ├── ArendFieldDefIdentifier.kt │ │ │ ├── ArendFunctionBody.kt │ │ │ ├── ArendFunctionClauses.kt │ │ │ ├── ArendFunctionDefinition.kt │ │ │ ├── ArendGoal.kt │ │ │ ├── ArendGroup.kt │ │ │ ├── ArendIPName.kt │ │ │ ├── ArendIdentifierOrUnknown.kt │ │ │ ├── ArendLamExpr.kt │ │ │ ├── ArendLamParam.kt │ │ │ ├── ArendLetClause.kt │ │ │ ├── ArendLetExpr.kt │ │ │ ├── ArendLevelCmp.kt │ │ │ ├── ArendLevelExpr.kt │ │ │ ├── ArendLevelParamsSeq.kt │ │ │ ├── ArendLevelsExpr.kt │ │ │ ├── ArendLiteral.kt │ │ │ ├── ArendLocalCoClause.kt │ │ │ ├── ArendLongName.kt │ │ │ ├── ArendLongNameExpr.kt │ │ │ ├── ArendMaybeAtomLevelExpr.kt │ │ │ ├── ArendMaybeAtomLevelExprs.kt │ │ │ ├── ArendNewExpr.kt │ │ │ ├── ArendNsId.kt │ │ │ ├── ArendNsUsing.kt │ │ │ ├── ArendOnlyLevelExpr.kt │ │ │ ├── ArendOverriddenField.kt │ │ │ ├── ArendPattern.kt │ │ │ ├── ArendPiExpr.kt │ │ │ ├── ArendPrec.kt │ │ │ ├── ArendReferenceContainer.kt │ │ │ ├── ArendReferenceElement.kt │ │ │ ├── ArendReplLine.kt │ │ │ ├── ArendReturnExpr.kt │ │ │ ├── ArendSigmaExpr.kt │ │ │ ├── ArendStat.kt │ │ │ ├── ArendStatAccessMod.kt │ │ │ ├── ArendStatCmd.kt │ │ │ ├── ArendSuperClass.kt │ │ │ ├── ArendTele.kt │ │ │ ├── ArendTopLevelLevelExpr.kt │ │ │ ├── ArendTuple.kt │ │ │ ├── ArendTupleExpr.kt │ │ │ ├── ArendTypedExpr.kt │ │ │ ├── ArendUniverseExpr.kt │ │ │ ├── ArendWhere.kt │ │ │ ├── ArendWithBody.kt │ │ │ ├── CoClauseBase.kt │ │ │ ├── Identifiers.kt │ │ │ ├── PsiConcreteReferable.kt │ │ │ ├── PsiLocatedReferable.kt │ │ │ ├── PsiReferable.kt │ │ │ ├── ReferableBase.kt │ │ │ ├── TCDefinition.kt │ │ │ └── Universes.kt │ │ ├── listener │ │ │ ├── ArendDefinitionChangeListener.kt │ │ │ └── ArendPsiChangeService.kt │ │ └── stubs │ │ │ ├── ArendStubElementType.kt │ │ │ ├── StubImplementations.kt │ │ │ ├── StubIndexing.kt │ │ │ ├── StubInterfaces.kt │ │ │ └── index │ │ │ ├── ArendDefinitionIndex.kt │ │ │ ├── ArendFileIndex.kt │ │ │ ├── ArendGotoClassIndex.kt │ │ │ └── ArendNamedElementIndex.kt │ │ ├── quickfix │ │ ├── AddMissingArgumentsQuickFix.kt │ │ ├── AddReturnKeywordQuickFix.kt │ │ ├── AddTruncatedUniverseQuickFix.kt │ │ ├── ArendQuickFixesBase.kt │ │ ├── DataUniverseQuickFix.kt │ │ ├── ElimSubstQuickFix.kt │ │ ├── ExpectedConstructorQuickFix.kt │ │ ├── ExplicitnessQuickFix.kt │ │ ├── FieldDependencyQuickFix.kt │ │ ├── FunctionArgInferenceQuickFix.kt │ │ ├── GoalFillingQuickFix.kt │ │ ├── GoalSolverFillingQuickFix.kt │ │ ├── HideImportQuickFix.kt │ │ ├── ImplementMissingClausesQuickFix.kt │ │ ├── ImplicitLambdaQuickFix.kt │ │ ├── ImplicitnessQuickFix.kt │ │ ├── ImpossibleEliminationQuickFix.kt │ │ ├── InteractiveGoalSolverQuickFix.kt │ │ ├── LambdaInferenceQuickFix.kt │ │ ├── MakePatternExplicitQuickFix.kt │ │ ├── MisplacedImportQuickFix.kt │ │ ├── RenameDuplicateNameQuickFix.kt │ │ ├── SquashedDataQuickFix.kt │ │ ├── TruncatedDataQuickFix.kt │ │ ├── implementCoClause │ │ │ ├── FirstCoClauseInserters.kt │ │ │ ├── ImplementFieldsQuickFix.kt │ │ │ ├── InstanceQuickFix.kt │ │ │ └── IntentionBackEndVisitor.kt │ │ ├── instance │ │ │ ├── AddInstanceArgumentQuickFix.kt │ │ │ ├── AddRecursiveInstanceArgumentQuickFix.kt │ │ │ ├── InstanceInferenceQuickFix.kt │ │ │ └── ReplaceWithLocalInstanceQuickFix.kt │ │ ├── referenceResolve │ │ │ ├── ArendAddImportAction.kt │ │ │ ├── ArendImportHintAction.kt │ │ │ └── ResolveReferenceAction.kt │ │ ├── removers │ │ │ ├── RemoveArgumentQuickFix.kt │ │ │ ├── RemoveAsPatternQuickFix.kt │ │ │ ├── RemoveClassifyingFieldQuickFix.kt │ │ │ ├── RemoveClauseQuickFix.kt │ │ │ ├── RemoveCoClauseQuickFix.kt │ │ │ ├── RemoveIgnoredLevelsQuickFix.kt │ │ │ ├── RemoveLevelQuickFix.kt │ │ │ ├── RemoveNoClassifyingKeywordQuickFix.kt │ │ │ ├── RemovePatternRightHandSideQuickFix.kt │ │ │ ├── RemovePatternsQuickFix.kt │ │ │ ├── RemoveStrictKeywordQuickFix.kt │ │ │ ├── RemoveTruncatedKeywordQuickFix.kt │ │ │ ├── RemoveTruncatedUniverseQuickFix.kt │ │ │ ├── RemoveTupleExprQuickFix.kt │ │ │ └── RemoveUseLevelQuickFix.kt │ │ └── replacers │ │ │ ├── ReplaceAbsurdPatternQuickFix.kt │ │ │ ├── ReplaceFieldKindQuickFix.kt │ │ │ ├── ReplaceFunctionKindQuickFix.kt │ │ │ ├── ReplaceSigmaFieldKindQuickFix.kt │ │ │ └── ReplaceWithWildcardPatternQuickFix.kt │ │ ├── refactoring │ │ ├── ArendMoveFileHandler.kt │ │ ├── ArendNamesValidator.kt │ │ ├── ArendRefactoringSupportProvider.kt │ │ ├── ArendRefactoringUtils.kt │ │ ├── ArendReferenceNameCalculatorUtils.kt │ │ ├── ArendRenameInputValidator.kt │ │ ├── ArendRenameModuleHandler.kt │ │ ├── ArendRenamePsiElementProcessor.kt │ │ ├── ArendSubExprUtils.kt │ │ ├── PsiLocatedRenamer.kt │ │ ├── changeSignature │ │ │ ├── ArendChangeInfo.kt │ │ │ ├── ArendChangeSignatureDescriptor.kt │ │ │ ├── ArendChangeSignatureDialog.kt │ │ │ ├── ArendChangeSignatureDialogParameter.kt │ │ │ ├── ArendChangeSignatureDialogParameterTableModelItem.kt │ │ │ ├── ArendChangeSignatureHandler.kt │ │ │ ├── ArendChangeSignatureProcessor.kt │ │ │ ├── ArendChangeSignatureUsageProcessor.kt │ │ │ ├── ArendChangeSignatureUtils.kt │ │ │ ├── ArendParameterTableModel.kt │ │ │ ├── ArendParametersInfo.kt │ │ │ ├── ArendTextualParameter.kt │ │ │ ├── ArendUsageInfo.kt │ │ │ ├── ChangeSignatureRefactoringDescriptor.kt │ │ │ ├── DoubleStringBuilder.kt │ │ │ └── entries │ │ │ │ ├── AbstractExpressionEntry.kt │ │ │ │ ├── AppExpressionEntry.kt │ │ │ │ ├── CoClauseEntry.kt │ │ │ │ ├── NoArgumentsEntry.kt │ │ │ │ ├── PatternEntry.kt │ │ │ │ └── UsageEntry.kt │ │ ├── move │ │ │ ├── ArendLongNameCodeFragment.kt │ │ │ ├── ArendMoveHandlerDelegate.kt │ │ │ ├── ArendMoveMembersDialog.kt │ │ │ ├── ArendMoveRefactoringProcessor.kt │ │ │ └── MoveRefactoringSignatureContext.kt │ │ └── rename │ │ │ ├── ArendAliasNameSuggestionProvider.kt │ │ │ └── ArendGlobalReferableRenameHandler.kt │ │ ├── resolving │ │ ├── ArendReferableConverter.kt │ │ ├── ArendReference.kt │ │ ├── ArendResolveCache.kt │ │ ├── ArendResolverListener.kt │ │ ├── BaseReferableConverter.kt │ │ ├── DataLocatedReferable.kt │ │ ├── IntellijMetaReferable.kt │ │ ├── IntellijTCLevelReferable.kt │ │ ├── IntellijTCReferable.kt │ │ ├── PsiConcreteProvider.kt │ │ └── util │ │ │ ├── BinOpParser.kt │ │ │ ├── ClassesUtil.kt │ │ │ ├── ReferableExtractVisitor.kt │ │ │ └── TypingUtil.kt │ │ ├── scratch │ │ ├── ArendScratchCompilingExecutor.kt │ │ ├── ArendScratchFile.kt │ │ ├── ArendScratchFileCreationHelper.kt │ │ ├── ArendScratchFileEditorProvider.kt │ │ ├── ArendScratchFileLanguageProvider.kt │ │ ├── ArendScratchFileModuleInfoProvider.kt │ │ ├── ArendScratchModuleService.kt │ │ ├── ArendScratchReplExecutor.kt │ │ ├── ArendScratchTopPanel.kt │ │ ├── Utils.kt │ │ └── actions │ │ │ ├── ArendClearScratchAction.kt │ │ │ ├── ArendRunScratchAction.kt │ │ │ ├── ArendScratchAction.kt │ │ │ └── ArendStopScratchAction.kt │ │ ├── search │ │ ├── ArendCustomSearcher.kt │ │ ├── ArendFindUsagesProvider.kt │ │ ├── ArendGroupRuleProviders.kt │ │ ├── ArendUsageTypeProvider.kt │ │ ├── ArendWordScanner.kt │ │ ├── ClassDescendantsSearch.kt │ │ └── proof │ │ │ ├── ArendExpressionMatcher.kt │ │ │ ├── ArendProofSearchAction.kt │ │ │ ├── ArendProofSearchRenderer.kt │ │ │ ├── GearActionGroup.kt │ │ │ ├── ProofSearchQuery.kt │ │ │ ├── ProofSearchService.kt │ │ │ ├── ProofSearchUI.kt │ │ │ ├── ProofSearchUtils.kt │ │ │ ├── ShowHelpAction.kt │ │ │ └── ShowInFindWindowAction.kt │ │ ├── settings │ │ ├── ArendCustomCodeStyleSettings.kt │ │ ├── ArendProjectSettings.kt │ │ ├── ArendProjectSettingsState.kt │ │ ├── ArendProjectStatistics.kt │ │ └── ArendSettings.kt │ │ ├── structure │ │ ├── ArendPsiStructureViewFactory.kt │ │ ├── ArendStructureViewBuilderProvider.kt │ │ └── ArendStructureViewModel.kt │ │ ├── toolWindow │ │ ├── SimpleToolWindowService.kt │ │ ├── errors │ │ │ ├── ArendClearGoalAction.kt │ │ │ ├── ArendMessagesFactory.kt │ │ │ ├── ArendMessagesFilterAction.kt │ │ │ ├── ArendMessagesFilterActionGroup.kt │ │ │ ├── ArendMessagesService.kt │ │ │ ├── ArendMessagesView.kt │ │ │ ├── ArendMessagesViewEditor.kt │ │ │ ├── ArendPinErrorAction.kt │ │ │ ├── ArendPinGoalAction.kt │ │ │ ├── ArendPrintOptionsActionGroup.kt │ │ │ ├── ArendPrintOptionsFilterAction.kt │ │ │ ├── ArendShowErrorsPanelAction.kt │ │ │ ├── ArendShowGoalsInErrorsPanelAction.kt │ │ │ ├── ArendShowImplicitGoalsAction.kt │ │ │ ├── JDocBuilder.kt │ │ │ ├── MessageType.kt │ │ │ └── tree │ │ │ │ ├── ArendErrorTree.kt │ │ │ │ ├── ArendErrorTreeAutoScrollFromSource.kt │ │ │ │ ├── ArendErrorTreeAutoScrollToSource.kt │ │ │ │ ├── ArendErrorTreeCellRenderer.kt │ │ │ │ ├── ArendErrorTreeCellRendererService.kt │ │ │ │ ├── ArendErrorTreeElement.kt │ │ │ │ └── ArendErrorTreeListener.kt │ │ └── repl │ │ │ ├── ArendReplCompletion.kt │ │ │ ├── ArendReplExecutionHandler.kt │ │ │ ├── ArendReplService.kt │ │ │ ├── ArendShowReplAction.kt │ │ │ ├── IntellijRepl.kt │ │ │ └── action │ │ │ ├── IntellijReplCommand.kt │ │ │ ├── SetPromptCommand.kt │ │ │ └── ShowContextCommandIntellij.kt │ │ ├── tracer │ │ ├── ArendSuspendContext.kt │ │ ├── ArendTrace.kt │ │ ├── ArendTraceAction.kt │ │ ├── ArendTraceContextView.kt │ │ ├── ArendTraceProcess.kt │ │ ├── ArendTraceSyntheticError.kt │ │ └── ArendTracingTypechecker.kt │ │ ├── typechecking │ │ ├── ArendExpressionTypechecker.kt │ │ ├── ArendExtensionChangeListener.kt │ │ ├── ArendExtensionChangeService.kt │ │ ├── ArendLibraryResolver.kt │ │ ├── ArendTypechecking.kt │ │ ├── BackgroundTypechecker.kt │ │ ├── BinaryFileSaver.kt │ │ ├── DefinitionBlacklistService.kt │ │ ├── ModificationCancellationIndicator.kt │ │ ├── ProgressCancellationIndicator.kt │ │ ├── PsiInstanceProviderSet.kt │ │ ├── TestBasedTypechecking.kt │ │ ├── TypeCheckingService.kt │ │ ├── TypecheckingTaskQueue.kt │ │ ├── error │ │ │ ├── ArendError.kt │ │ │ ├── ErrorService.kt │ │ │ ├── NotificationErrorReporter.kt │ │ │ ├── ParserError.kt │ │ │ ├── PsiHyperlinkInfo.kt │ │ │ ├── PsiSourceInfo.kt │ │ │ └── TypecheckingErrorReporter.kt │ │ └── execution │ │ │ ├── DefinitionProxy.kt │ │ │ ├── PsiElementComparator.kt │ │ │ ├── TypeCheckCommand.kt │ │ │ ├── TypeCheckProcessHandler.kt │ │ │ ├── TypeCheckRunConfigurationEditor.kt │ │ │ ├── TypeCheckRunLineMarkerContributor.kt │ │ │ ├── TypeCheckRunner.kt │ │ │ ├── TypecheckRunConfigurationProducer.kt │ │ │ ├── TypecheckingEventsProcessor.kt │ │ │ └── configurations │ │ │ ├── ArendRunConfigurationFactory.kt │ │ │ ├── TypeCheckConfiguration.kt │ │ │ ├── TypeCheckRunConfigurationModule.kt │ │ │ ├── TypeCheckRunState.kt │ │ │ └── TypecheckRunConfigurationType.kt │ │ ├── ui │ │ ├── ArendDialog.kt │ │ ├── ArendEditor.kt │ │ ├── ArendManipulateImplicitArgumentComponent.kt │ │ ├── DualList.kt │ │ ├── IconButton.kt │ │ ├── ListsDnD.kt │ │ ├── SimpleListModel.kt │ │ ├── TextFieldChangeListener.kt │ │ ├── cellRenderer │ │ │ └── ToolTipListCellRenderer.kt │ │ ├── console │ │ │ ├── ArendClearConsoleAction.kt │ │ │ ├── ArendConsoleService.kt │ │ │ ├── ArendConsoleView.kt │ │ │ └── ArendConsoleViewEditor.kt │ │ └── impl │ │ │ ├── ArendConsoleImpl.kt │ │ │ ├── ArendEditorUI.kt │ │ │ ├── ArendGeneralUI.kt │ │ │ ├── query │ │ │ ├── CheckBoxQuery.kt │ │ │ ├── ComboBoxQuery.kt │ │ │ ├── SpinnerQuery.kt │ │ │ └── TextFieldQuery.kt │ │ │ └── session │ │ │ ├── ArendEditorSession.kt │ │ │ ├── ArendSessionsService.kt │ │ │ ├── ArendToolWindowSession.kt │ │ │ ├── ComponentSession.kt │ │ │ ├── ComponentSessionItem.kt │ │ │ └── LabeledComponent.kt │ │ ├── util │ │ ├── ArendBinOpUtils.kt │ │ ├── ArendBundle.kt │ │ ├── ArendLibraryChooserDescriptor.kt │ │ ├── ExpressionUtils.kt │ │ ├── FileUtils.kt │ │ ├── FreeVariablesWithDependenciesCollector.kt │ │ ├── KotlinUtils.kt │ │ ├── ProjectUtils.kt │ │ └── VirtualFileUtils.kt │ │ └── yaml │ │ ├── Utils.kt │ │ ├── YAMLFileListener.kt │ │ ├── YamlFileService.kt │ │ ├── YamlNotificationProvider.kt │ │ ├── codeInsight │ │ ├── YAMLCompletionContributor.kt │ │ ├── YAMLHighlightingAnnotator.kt │ │ └── YAMLReferenceContributor.kt │ │ └── schema │ │ ├── ArendYamlSchemaEnabler.kt │ │ ├── ArendYamlSchemaProvider.kt │ │ └── ArendYamlSchemaProviderFactory.kt └── resources │ ├── META-INF │ ├── plugin-json.xml │ ├── plugin.xml │ └── pluginIcon.svg │ ├── fileTemplates │ └── internal │ │ ├── Arend File.ard.ft │ │ └── Arend File.ard.html │ ├── icons │ ├── arend.svg │ ├── arend_file.svg │ ├── checkmark.svg │ ├── constructor.svg │ ├── dataStructure.svg │ ├── field.svg │ ├── goal.svg │ ├── goal_dark.svg │ ├── moveLeft.svg │ ├── moveLeft_dark.svg │ ├── moveRight.svg │ ├── moveRight_dark.svg │ ├── not_show.svg │ ├── not_show_dark.svg │ ├── orthogonal_graph.svg │ ├── showFieldImpl.png │ ├── showFieldImpl.svg │ ├── showFieldImpl_dark.svg │ ├── showImplicits.svg │ ├── showImplicits_dark.svg │ ├── showNonImpl.png │ ├── showNonImpl.svg │ ├── showNonImpl_dark.svg │ ├── toolWindowMessages.svg │ ├── toolWindowMessages_dark.svg │ └── turnstile.svg │ ├── inspectionDescriptions │ ├── ArendUnusedImport.html │ ├── RedundantParameter.html │ ├── RedundantParens.html │ └── UnresolvedArendPattern.html │ ├── intentionDescriptions │ ├── AddClarifyingParensIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── ChangeArgumentExplicitnessIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── CreateLetBindingIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── ExtractExpressionToFunctionIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── GenerateElimMissingClausesIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── GenerateFunctionFromGoalIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── GenerateMissingClausesIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── ImplementFieldsInCoClauseIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── RemoveClarifyingParensIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── ReplaceBracketsIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── ReplaceMetaWithResultIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── ReplaceWithNormalFormIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── ReplaceWithShortNameIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── SplitAtomPatternIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── SwapInfixOperatorArgumentsIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ └── WrapInGoalIntention │ │ ├── after.ard.template │ │ ├── before.ard.template │ │ └── description.html │ ├── jsonSchema │ └── arend.yaml.json │ ├── lib │ └── Prelude.ard │ ├── liveTemplates │ └── Arend.xml │ ├── messages │ └── ArendBundle.properties │ └── starters │ └── intellij-arend.pom └── test ├── kotlin └── org │ └── arend │ ├── ArendTestBase.kt │ ├── ArendTestCase.kt │ ├── FileTree.kt │ ├── ParsingTest.kt │ ├── actions │ └── ArendExtendWordSelectionTest.kt │ ├── codeInsight │ ├── ArendBracesTest.kt │ ├── ArendTypedHandlerTest.kt │ ├── completion │ │ ├── ArendCompletionTestBase.kt │ │ ├── ArendFieldCompletionTest.kt │ │ ├── ArendFilteredScope.kt │ │ ├── ArendKeywordCompletionTest.kt │ │ ├── ArendLiveTemplateCompletionTest.kt │ │ ├── ArendModuleCompletionTest.kt │ │ └── ArendPreludeCompletionTest.kt │ └── parameterInfo │ │ ├── ArendParameterInfoTest.kt │ │ └── MockParameterInfoUIContext.kt │ ├── commenter │ └── ArendCommenterTest.kt │ ├── documentation │ └── ArendDocumentationCommentTest.kt │ ├── formatting │ ├── ArendDocCommentNewLineTest.kt │ ├── ArendDocCommentReformatTest.kt │ ├── ArendFormatterTestBase.kt │ ├── ArendNewlineTest.kt │ └── ArendReformatTest.kt │ ├── hierarchy │ └── ArendClassHierarchyTest.kt │ ├── inspection │ ├── ArendInspectionSuppressorTest.kt │ ├── InspectionUtilTest.kt │ ├── NameShadowingInspectionTest.kt │ ├── PartiallyInfixOperatorPrefixFormInspectionTest.kt │ ├── RedundantParameterInspectionTest.kt │ ├── RedundantParensInspectionTest.kt │ └── UnresolvedArendPatternInspectionTest.kt │ ├── intention │ ├── AddClarifyingParensIntentionTest.kt │ ├── BaseIntentionTest.kt │ ├── ChangeArgumentExplicitnessIntentionTest.kt │ ├── CreateLetBindingIntentionTest.kt │ ├── ExtractExpressionToFunctionIntentionTest.kt │ ├── GenerateFunctionFromGoalIntentionTest.kt │ ├── GenerateMissingClausesIntentionTest.kt │ ├── OptimizeImportsTest.kt │ ├── RemoveClarifyingParensIntentionTest.kt │ ├── ReplaceBracketsIntentionTest.kt │ ├── ReplaceWithShortNameIntentionTest.kt │ ├── SplitAtomPatternIntentionTest.kt │ ├── SwapInfixOperatorArgumentsIntentionTest.kt │ └── WrapInGoalIntentionTest.kt │ ├── navigation │ ├── ArendFileNavigationContributorTest.kt │ ├── ArendNavBarExtensionTest.kt │ └── ArendSymbolNavigationContributorTest.kt │ ├── project │ └── ArendProjectViewTest.kt │ ├── psi │ └── ArendFileModificationCountTest.kt │ ├── quickfix │ ├── AddRecursiveInstanceArgumentQuickFixTest.kt │ ├── AddReturnKeywordQuickFixTest.kt │ ├── AddTruncatedUniverseQuickFixTest.kt │ ├── DataUniverseQuickFixTest.kt │ ├── ElimSubstQuickFixTest.kt │ ├── ExpectedConstructorQuickFixTest.kt │ ├── ExplicitnessQuickFixTest.kt │ ├── FieldDependencyQuickFixTest.kt │ ├── FunctionArgInferenceQuickFixTest.kt │ ├── GoalFillingQuickFixTest.kt │ ├── ImplementFieldsQuickFixTest.kt │ ├── ImplicitLambdaQuickFixTest.kt │ ├── ImportQuickFixTest.kt │ ├── ImpossibleEliminationQuickFixTest.kt │ ├── InstanceInferenceQuickFixTest.kt │ ├── InteractiveGoalSolverQuickFixTest.kt │ ├── LambdaInferenceQuickFixTest.kt │ ├── MissingClausesQuickFixTest.kt │ ├── PatternQuickFixTest.kt │ ├── QuickFixTestBase.kt │ ├── RemoveClassifyingFieldQuickFixTest.kt │ ├── RemoveIgnoredLevelsQuickFixTest.kt │ ├── RemoveLevelQuickFixTest.kt │ ├── RemoveNoClassifyingKeywordQuickFixTest.kt │ ├── RemoveStrictKeywordQuickFixTest.kt │ ├── RemoveTruncatedKeywordQuickFixTest.kt │ ├── RemoveTruncatedUniverseQuickFixTest.kt │ ├── RemoveUseLevelQuickFixTest.kt │ ├── ReplaceDefKindQuickFix.kt │ ├── ReplaceMetaWithResultTest.kt │ ├── ResolveRefQuickFixTest.kt │ ├── SquashedDataQuickFixTest.kt │ └── TruncatedDataQuickFixTest.kt │ ├── refactoring │ ├── ArendChangeSignatureTest.kt │ ├── ArendChangeSignatureTestBase.kt │ ├── ArendMoveMemberTest.kt │ ├── ArendMoveTestBase.kt │ ├── RenameTest.kt │ └── SubExprTest.kt │ ├── search │ ├── ArendProofSearchInsertTest.kt │ ├── ArendProofSearchTest.kt │ ├── ArendReferenceSearchTest.kt │ └── proof │ │ └── ParsingTest.kt │ ├── toolwindow │ └── ArendRevealingTest.kt │ ├── tracer │ ├── ArendSuspendContextTest.kt │ ├── ArendTraceEntriesTest.kt │ └── ArendTraceTestBase.kt │ ├── util │ └── ArendBinOpUtilTest.kt │ └── yaml │ └── YAMLFileTest.kt └── resources └── org └── arend ├── arend-lib ├── arend.yaml └── src │ └── Function.ard ├── commenter └── fixtures │ ├── indented_single_line_comment.ard │ ├── indented_single_line_comment_after.ard │ ├── multi_line.ard │ ├── multi_line_after.ard │ ├── multi_line_block.ard │ ├── multi_line_block_after.ard │ ├── multi_line_block_uncomment.ard │ ├── multi_line_block_uncomment_after.ard │ ├── multi_line_uncomment.ard │ ├── multi_line_uncomment_after.ard │ ├── single_line.ard │ ├── single_line_after.ard │ ├── single_line_block.ard │ ├── single_line_block_after.ard │ ├── single_line_block_uncomment.ard │ ├── single_line_block_uncomment_after.ard │ ├── single_line_uncomment.ard │ ├── single_line_uncomment_after.ard │ ├── single_line_uncomment_with_space.ard │ └── single_line_uncomment_with_space_after.ard ├── parser └── fixtures │ ├── BareExprCommand.ard │ ├── BareExprCommand.txt │ ├── ColonExprs.ard │ ├── ColonExprs.txt │ ├── MixedReplCommandAndColon.ard │ ├── MixedReplCommandAndColon.txt │ ├── MixedReplCommandAndColon2.ard │ ├── MixedReplCommandAndColon2.txt │ ├── ReplTypeCommand.ard │ ├── ReplTypeCommand.txt │ ├── SimpleDef.ard │ └── SimpleDef.txt └── yaml └── arend.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.ear 17 | *.zip 18 | *.tar.gz 19 | *.rar 20 | 21 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 22 | hs_err_pid* 23 | 24 | # Gradle wrapper 25 | !gradle/wrapper/gradle-wrapper.jar 26 | 27 | # Arend 28 | !lib/arend-*.jar 29 | 30 | # Intellij 31 | *.iml 32 | 33 | # The IntelliJ Platform cache directory 34 | .intellijPlatform 35 | 36 | .gradle/ 37 | .idea/ 38 | build/ 39 | 40 | out/ 41 | src/gen/ 42 | src/main/doc-lexer 43 | src/main/lexer 44 | src/main/parser 45 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xms512M -Xmx6g -XX:MaxMetaspaceSize=1g -Dkotlin.daemon.jvm.options=-Xmx6g 2 | kotlin.stdlib.default.dependency = false 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JetBrains/intellij-arend/023f903ab1a6b9c55d7b7fc1e60e21be2e24597c/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "intellij-arend" 2 | 3 | includeBuild("../Arend") -------------------------------------------------------------------------------- /src/main/html/change-notes.html: -------------------------------------------------------------------------------- 1 | Platform update -------------------------------------------------------------------------------- /src/main/html/description.html: -------------------------------------------------------------------------------- 1 | Arend is a proof assistant based on homotopy type theory. 2 | This plugin adds support for the Arend language. 3 | To learn more about this plugin, visit the website. 5 | -------------------------------------------------------------------------------- /src/main/html/highlight-hover.js: -------------------------------------------------------------------------------- 1 | // Copyright 2023, Andreas Abel. 2 | // Falls under the Agda license at https://github.com/agda/agda/blob/master/LICENSE 3 | 4 | const dict = new Map(); 5 | 6 | window.onload = function () { 7 | const objs = document.querySelectorAll('a[href]'); 8 | 9 | for (const obj of objs) { 10 | const key = obj.href; 11 | const set = dict.get(key) ?? new Set(); 12 | set.add(obj); 13 | dict.set(key, set); 14 | } 15 | 16 | for (const obj of objs) { 17 | obj.onmouseover = function () { 18 | for (const o of dict.get(this.href)) { o.classList.add('hover-highlight'); } 19 | } 20 | obj.onmouseout = function () { 21 | for (const o of dict.get(this.href)) { o.classList.remove('hover-highlight'); } 22 | } 23 | } 24 | }; -------------------------------------------------------------------------------- /src/main/java/org/arend/ArendLanguage.java: -------------------------------------------------------------------------------- 1 | package org.arend; 2 | 3 | import com.intellij.lang.Language; 4 | 5 | public class ArendLanguage extends Language { 6 | public static final ArendLanguage INSTANCE = new ArendLanguage(); 7 | 8 | protected ArendLanguage() { 9 | super("Arend"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/arend/InjectionTextLanguage.java: -------------------------------------------------------------------------------- 1 | package org.arend; 2 | 3 | import com.intellij.lang.Language; 4 | 5 | public class InjectionTextLanguage extends Language { 6 | public static final InjectionTextLanguage INSTANCE = new InjectionTextLanguage(); 7 | 8 | protected InjectionTextLanguage() { 9 | super("INJECTION_TEXT"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ArendFileType.kt: -------------------------------------------------------------------------------- 1 | package org.arend 2 | 3 | import com.intellij.openapi.fileTypes.LanguageFileType 4 | import org.arend.util.FileUtils 5 | 6 | open class ArendFileType : LanguageFileType(ArendLanguage.INSTANCE) { 7 | override fun getName(): String = "Arend" 8 | 9 | override fun getDescription(): String = "Arend files" 10 | 11 | override fun getDefaultExtension(): String = FileUtils.EXTENSION.drop(1) 12 | 13 | override fun getIcon() = ArendIcons.AREND_FILE 14 | } 15 | 16 | object ArendFileTypeInstance : ArendFileType() -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/IArendFile.kt: -------------------------------------------------------------------------------- 1 | package org.arend 2 | 3 | import com.intellij.psi.PsiFile 4 | import org.arend.psi.ext.ArendCompositeElement 5 | import org.arend.term.group.Group 6 | import java.util.concurrent.atomic.AtomicLong 7 | 8 | interface IArendFile: PsiFile, ArendCompositeElement { 9 | var lastModification: AtomicLong 10 | 11 | fun moduleInitialized(): Boolean = true 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/actions/ArendActions.kt: -------------------------------------------------------------------------------- 1 | package org.arend.actions 2 | 3 | import com.intellij.openapi.actionSystem.DefaultActionGroup 4 | import org.arend.ArendIcons.AREND 5 | 6 | class ArendActions : DefaultActionGroup("Arend", "Show Arend Actions", AREND) { 7 | init { 8 | templatePresentation.isPopupGroup = true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/actions/ArendNormalizeToggleAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.actions 2 | 3 | import com.intellij.openapi.actionSystem.ActionUpdateThread 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import com.intellij.openapi.actionSystem.ToggleAction 6 | import com.intellij.openapi.components.service 7 | import org.arend.ArendIcons 8 | import org.arend.settings.ArendProjectSettings 9 | 10 | object ArendNormalizeToggleAction : ToggleAction() { 11 | init { 12 | templatePresentation.icon = ArendIcons.SHOW_NORMALIZED 13 | } 14 | 15 | override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT 16 | 17 | override fun isSelected(e: AnActionEvent) = 18 | e.project?.run { service().data.popupNormalize } ?: false 19 | 20 | override fun setSelected(e: AnActionEvent, state: Boolean) { 21 | e.project?.run { service().data.popupNormalize = state } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/actions/ArendToolbarGroup.kt: -------------------------------------------------------------------------------- 1 | package org.arend.actions 2 | 3 | import com.intellij.openapi.actionSystem.* 4 | import org.arend.toolWindow.errors.ArendPrintOptionsActionGroup 5 | import org.arend.toolWindow.errors.PrintOptionKind 6 | 7 | class ArendToolbarGroup : ActionGroup() { 8 | override fun getChildren(eNull: AnActionEvent?): Array { 9 | val e = eNull ?: return emptyArray() 10 | val project = e.project ?: return emptyArray() 11 | if (project.isDisposed) return emptyArray() 12 | return arrayOf( 13 | Separator.getInstance(), 14 | ArendNormalizeToggleAction, 15 | ArendPrintOptionsActionGroup(project, PrintOptionKind.POPUP_PRINT_OPTIONS) 16 | ) 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/actions/GotoArendFileAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.actions 2 | 3 | import com.intellij.ide.actions.GotoFileAction 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import com.intellij.openapi.actionSystem.CommonDataKeys 6 | import com.intellij.openapi.actionSystem.DataContext 7 | import com.intellij.openapi.project.Project 8 | import org.arend.util.arendModules 9 | 10 | class GotoArendFileAction : GotoFileAction(){ 11 | override fun actionPerformed(e: AnActionEvent) { 12 | showInSearchEverywherePopup(SearchArendFilesContributor::class.java.simpleName, e, true, true) 13 | } 14 | 15 | override fun hasContributors(context: DataContext?): Boolean = 16 | if (context != null) { 17 | val project: Project? = CommonDataKeys.PROJECT.getData(context) 18 | project?.arendModules?.isNotEmpty() ?: false 19 | } else false 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/actions/mark/ArendMarkBinRootAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.actions.mark 2 | 3 | import com.intellij.ide.projectView.actions.MarkExcludeRootAction 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import org.arend.util.ArendBundle 6 | 7 | class ArendMarkBinRootAction : MarkExcludeRootAction() { 8 | 9 | init { 10 | templatePresentation.text = ArendBundle.message("arend.icon.modules.binRoot.tooltip") 11 | } 12 | 13 | override fun update(e: AnActionEvent) { 14 | if (isNotOtherDirectoryType(e)) { 15 | e.presentation.isEnabledAndVisible = true 16 | super.update(e) 17 | } else { 18 | e.presentation.isEnabledAndVisible = false 19 | } 20 | } 21 | 22 | override fun actionPerformed(e: AnActionEvent) { 23 | unmarkDirectory(e, DirectoryType.BIN) 24 | super.actionPerformed(e) 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/actions/mark/ArendMarkExcludeRootAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.actions.mark 2 | 3 | import com.intellij.ide.projectView.actions.MarkExcludeRootAction 4 | import com.intellij.idea.ActionsBundle 5 | import com.intellij.openapi.actionSystem.AnActionEvent 6 | 7 | class ArendMarkExcludeRootAction : MarkExcludeRootAction() { 8 | init { 9 | templatePresentation.text = ActionsBundle.message("action.MarkExcludeRoot.text") 10 | } 11 | 12 | override fun update(e: AnActionEvent) { 13 | if (hasSpecialDirectories(e)) { 14 | e.presentation.isEnabledAndVisible = false 15 | } else { 16 | e.presentation.isEnabledAndVisible = true 17 | super.update(e) 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/actions/mark/ArendMarkResourceRootAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.actions.mark 2 | 3 | import com.intellij.ide.projectView.actions.MarkSourceRootAction 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import org.jetbrains.jps.model.java.JavaResourceRootType 6 | 7 | class ArendMarkResourceRootAction : MarkSourceRootAction(JavaResourceRootType.RESOURCE) { 8 | override fun update(e: AnActionEvent) { 9 | if (hasSpecialDirectories(e)) { 10 | e.presentation.isEnabledAndVisible = false 11 | } else { 12 | e.presentation.isEnabledAndVisible = true 13 | super.update(e) 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/actions/mark/ArendMarkResourceTestRootAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.actions.mark 2 | 3 | import com.intellij.ide.projectView.actions.MarkSourceRootAction 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import org.jetbrains.jps.model.java.JavaResourceRootType 6 | 7 | class ArendMarkResourceTestRootAction : MarkSourceRootAction(JavaResourceRootType.TEST_RESOURCE) { 8 | override fun update(e: AnActionEvent) { 9 | if (hasSpecialDirectories(e)) { 10 | e.presentation.isEnabledAndVisible = false 11 | } else { 12 | e.presentation.isEnabledAndVisible = true 13 | super.update(e) 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/actions/mark/ArendMarkSourceRootAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.actions.mark 2 | 3 | import com.intellij.ide.projectView.actions.MarkSourceRootAction 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import org.jetbrains.jps.model.java.JavaSourceRootType 6 | 7 | class ArendMarkSourceRootAction : MarkSourceRootAction(JavaSourceRootType.SOURCE) { 8 | override fun update(e: AnActionEvent) { 9 | if (isNotOtherDirectoryType(e)) { 10 | e.presentation.isEnabledAndVisible = true 11 | super.update(e) 12 | } else { 13 | e.presentation.isEnabledAndVisible = false 14 | } 15 | } 16 | 17 | override fun actionPerformed(e: AnActionEvent) { 18 | unmarkDirectory(e, DirectoryType.SRC) 19 | super.actionPerformed(e) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/actions/mark/ArendMarkTestSourceRootAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.actions.mark 2 | 3 | import com.intellij.ide.projectView.actions.MarkSourceRootAction 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import org.jetbrains.jps.model.java.JavaSourceRootType 6 | 7 | class ArendMarkTestSourceRootAction : MarkSourceRootAction(JavaSourceRootType.TEST_SOURCE) { 8 | override fun update(e: AnActionEvent) { 9 | if (isNotOtherDirectoryType(e)) { 10 | e.presentation.isEnabledAndVisible = true 11 | super.update(e) 12 | } else { 13 | e.presentation.isEnabledAndVisible = false 14 | } 15 | } 16 | 17 | override fun actionPerformed(e: AnActionEvent) { 18 | unmarkDirectory(e, DirectoryType.TEST_SRC) 19 | super.actionPerformed(e) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/annotation/ArendHighlightRangeExtension.kt: -------------------------------------------------------------------------------- 1 | package org.arend.annotation 2 | 3 | import com.intellij.codeInsight.daemon.impl.HighlightRangeExtension 4 | import com.intellij.psi.PsiFile 5 | import org.arend.psi.ArendFile 6 | 7 | 8 | class ArendHighlightRangeExtension : HighlightRangeExtension { 9 | override fun isForceHighlightParents(file: PsiFile) = file is ArendFile 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/codeInsight/ArendCharFilter.kt: -------------------------------------------------------------------------------- 1 | package org.arend.codeInsight 2 | 3 | import com.intellij.codeInsight.lookup.CharFilter 4 | import com.intellij.codeInsight.lookup.Lookup 5 | import org.arend.ArendLanguage 6 | import org.arend.search.ArendWordScanner 7 | 8 | class ArendCharFilter : CharFilter() { 9 | override fun acceptChar(c: Char, prefixLength: Int, lookup: Lookup): Result? = 10 | if (lookup.psiFile?.language?.isKindOf(ArendLanguage.INSTANCE) == true) { 11 | if (ArendWordScanner.isArendIdentifierPart(c)) { 12 | Result.ADD_TO_PREFIX 13 | } else when (c) { 14 | '.', ',', ' ', '(' -> Result.SELECT_ITEM_AND_FINISH_LOOKUP 15 | else -> Result.HIDE_LOOKUP 16 | } 17 | } else { 18 | null 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/codeInsight/ArendStringQuoteHandler.kt: -------------------------------------------------------------------------------- 1 | package org.arend.codeInsight 2 | 3 | import com.intellij.codeInsight.editorActions.SimpleTokenSetQuoteHandler 4 | import com.intellij.psi.TokenType 5 | import org.arend.psi.ArendElementTypes 6 | 7 | class ArendStringQuoteHandler : SimpleTokenSetQuoteHandler(ArendElementTypes.STRING, TokenType.BAD_CHARACTER) 8 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/codeInsight/completion/ArendCompletionConfidence.kt: -------------------------------------------------------------------------------- 1 | package org.arend.codeInsight.completion 2 | 3 | import com.intellij.codeInsight.completion.CompletionConfidence 4 | import com.intellij.psi.PsiElement 5 | import com.intellij.psi.PsiFile 6 | import com.intellij.psi.impl.source.tree.LeafPsiElement 7 | import com.intellij.util.ThreeState 8 | import org.arend.psi.ArendElementTypes 9 | 10 | 11 | class ArendCompletionConfidence : CompletionConfidence() { 12 | override fun shouldSkipAutopopup(contextElement: PsiElement, psiFile: PsiFile, offset: Int): ThreeState = 13 | if (contextElement is LeafPsiElement && contextElement.elementType == ArendElementTypes.NUMBER) ThreeState.YES else ThreeState.UNSURE 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/codeInsight/completion/ReplaceInsertHandler.kt: -------------------------------------------------------------------------------- 1 | package org.arend.codeInsight.completion 2 | 3 | import com.intellij.codeInsight.completion.InsertHandler 4 | import com.intellij.codeInsight.completion.InsertionContext 5 | import com.intellij.codeInsight.lookup.LookupElement 6 | 7 | class ReplaceInsertHandler(private val replacement: String) : InsertHandler { 8 | override fun handleInsert(context: InsertionContext, item: LookupElement) { 9 | val document = context.document 10 | document.deleteString(context.startOffset, context.tailOffset) 11 | document.insertString(context.tailOffset, replacement) 12 | context.commitDocument() 13 | context.editor.caretModel.moveToOffset(context.tailOffset) 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/codeInsight/hints/ArendAxiomsInlayProvider.kt: -------------------------------------------------------------------------------- 1 | package org.arend.codeInsight.hints 2 | 3 | import com.intellij.codeInsight.hints.NoSettings 4 | import com.intellij.codeInsight.hints.SettingsKey 5 | import org.arend.core.definition.Definition 6 | 7 | @Suppress("UnstableApiUsage") 8 | class ArendAxiomsInlayProvider : ArendDefinitionInlayProvider() { 9 | override val key: SettingsKey 10 | get() = SettingsKey("arend.inlays.axioms") 11 | 12 | override val name: String 13 | get() = "Axioms" 14 | 15 | override val previewText: String 16 | get() = """ 17 | \axiom axiom : 0 = 0 18 | 19 | \func foo => axiom 20 | """.trimIndent() 21 | 22 | override val description 23 | get() = "Shows axioms used by a definition" 24 | 25 | override fun getText(definition: Definition): String? { 26 | val axioms = definition.axioms 27 | return if (axioms.isEmpty() || axioms.size == 1 && axioms.contains(definition)) null else "Axioms: " + axioms.joinToString() 28 | } 29 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/codeInsight/hints/ArendGoalsInlayProvider.kt: -------------------------------------------------------------------------------- 1 | package org.arend.codeInsight.hints 2 | 3 | import com.intellij.codeInsight.hints.NoSettings 4 | import com.intellij.codeInsight.hints.SettingsKey 5 | import org.arend.core.definition.Definition 6 | 7 | @Suppress("UnstableApiUsage") 8 | class ArendGoalsInlayProvider : ArendDefinitionInlayProvider() { 9 | override val key: SettingsKey 10 | get() = SettingsKey("arend.inlays.goals") 11 | 12 | override val name: String 13 | get() = "Goals" 14 | 15 | override val previewText: String 16 | get() = """ 17 | \func foo => {?} 18 | 19 | \func bar => foo 20 | """.trimIndent() 21 | 22 | override val description 23 | get() = "Shows definitions with goals used by a definition" 24 | 25 | override fun getText(definition: Definition): String? { 26 | val goals = HashSet(definition.goals) 27 | goals.remove(definition) 28 | return if (goals.isEmpty()) null else "Goals: " + goals.map { it.ref.refLongName }.joinToString() 29 | } 30 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/debug/ArendDebuggerRunner.kt: -------------------------------------------------------------------------------- 1 | package org.arend.debug 2 | 3 | import com.intellij.debugger.impl.GenericDebuggerRunner 4 | import com.intellij.execution.configurations.RunProfile 5 | import org.arend.typechecking.execution.configurations.TypeCheckConfiguration 6 | 7 | class ArendDebuggerRunner: GenericDebuggerRunner() { 8 | override fun getRunnerId(): String { 9 | return "ArendDebugRunner" 10 | } 11 | 12 | override fun canRun(executorId: String, profile: RunProfile) = 13 | profile is TypeCheckConfiguration 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/debug/ArendPositionManagerFactory.kt: -------------------------------------------------------------------------------- 1 | package org.arend.debug 2 | 3 | import com.intellij.debugger.PositionManager 4 | import com.intellij.debugger.PositionManagerFactory 5 | import com.intellij.debugger.engine.DebugProcess 6 | import com.intellij.debugger.engine.DebugProcessImpl 7 | import com.intellij.debugger.engine.PositionManagerImpl 8 | 9 | class ArendPositionManagerFactory: PositionManagerFactory() { 10 | override fun createPositionManager(process: DebugProcess): PositionManager? { 11 | return (process as? DebugProcessImpl)?.let { PositionManagerImpl(it) } 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/documentation/GenerateArendLibHtmlStarter.kt: -------------------------------------------------------------------------------- 1 | package org.arend.documentation 2 | 3 | import com.intellij.openapi.application.ApplicationStarter 4 | 5 | class GenerateArendLibHtmlStarter : ApplicationStarter { 6 | @Suppress("OVERRIDE_DEPRECATION") 7 | override val commandName: String 8 | get() = "generateArendLibHtml" 9 | 10 | override fun main(args: List) { 11 | val arguments = args.map { it.ifEmpty { null } } 12 | 13 | val pathToArendLib = arguments.getOrNull(1) ?: run { 14 | println("The path to the Arend library is not specified") 15 | return 16 | } 17 | val pathToArendLibInArendSite = arguments.getOrNull(2) ?: run { 18 | println("The path to the Arend library in Arend site is not specified") 19 | return 20 | } 21 | val versionArendLib = arguments.getOrNull(3) 22 | val updateColorScheme = arguments.getOrNull(4).toBoolean() 23 | 24 | generateHtmlForArendLib(pathToArendLib, pathToArendLibInArendSite, versionArendLib, updateColorScheme) 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/editor/ArendConfigurable.kt: -------------------------------------------------------------------------------- 1 | package org.arend.editor 2 | 3 | import com.intellij.openapi.options.SearchableConfigurable 4 | import javax.swing.JComponent 5 | 6 | 7 | class ArendConfigurable : SearchableConfigurable { 8 | private var settingsView: ArendSettingsView? = null 9 | 10 | override fun getId() = "preferences.language.Arend" 11 | 12 | override fun getDisplayName() = "Arend" 13 | 14 | override fun isModified() = settingsView?.isModified == true 15 | 16 | override fun apply() { 17 | settingsView?.apply() 18 | } 19 | 20 | override fun reset() { 21 | settingsView?.reset() 22 | } 23 | 24 | override fun createComponent(): JComponent? { 25 | settingsView = ArendSettingsView() 26 | return settingsView?.createComponent() 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/formatting/ArendBackspaceDisabler.kt: -------------------------------------------------------------------------------- 1 | package org.arend.formatting 2 | 3 | import com.intellij.codeInsight.editorActions.BackspaceModeOverride 4 | import com.intellij.codeInsight.editorActions.SmartBackspaceMode 5 | 6 | class ArendBackspaceDisabler : BackspaceModeOverride() { 7 | override fun getBackspaceMode(modeFromSettings: SmartBackspaceMode): SmartBackspaceMode { 8 | return if (modeFromSettings == SmartBackspaceMode.AUTOINDENT) SmartBackspaceMode.INDENT else modeFromSettings 9 | } 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/formatting/block/CommentPieceBlock.kt: -------------------------------------------------------------------------------- 1 | package org.arend.formatting.block 2 | 3 | import com.intellij.formatting.* 4 | import com.intellij.openapi.util.TextRange 5 | import java.util.ArrayList 6 | 7 | class CommentPieceBlock(private val myTextRange: TextRange, private val myAlign: Alignment?, private val myIndent: Indent?, val isDash: Boolean): Block { 8 | override fun getAlignment(): Alignment? = myAlign 9 | 10 | override fun isIncomplete(): Boolean = false 11 | 12 | override fun isLeaf(): Boolean = true 13 | 14 | override fun getSpacing(child1: Block?, child2: Block): Spacing? = null 15 | 16 | override fun getTextRange(): TextRange = myTextRange 17 | 18 | override fun getSubBlocks(): MutableList = ArrayList() 19 | 20 | override fun getChildAttributes(newChildIndex: Int): ChildAttributes = ChildAttributes(Indent.getNoneIndent(), null) 21 | 22 | override fun getWrap(): Wrap? = null 23 | 24 | override fun getIndent(): Indent? = myIndent 25 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/hierarchy/clazz/ArendClassHierarchyProvider.kt: -------------------------------------------------------------------------------- 1 | package org.arend.hierarchy.clazz 2 | 3 | import com.intellij.ide.hierarchy.HierarchyBrowser 4 | import com.intellij.ide.hierarchy.HierarchyProvider 5 | import com.intellij.ide.hierarchy.TypeHierarchyBrowserBase 6 | import com.intellij.openapi.actionSystem.CommonDataKeys 7 | import com.intellij.openapi.actionSystem.DataContext 8 | import com.intellij.psi.PsiElement 9 | import org.arend.psi.ext.ArendDefClass 10 | import org.arend.psi.parentOfType 11 | 12 | class ArendClassHierarchyProvider : HierarchyProvider { 13 | override fun getTarget(dataContext: DataContext): ArendDefClass? = 14 | CommonDataKeys.PSI_ELEMENT.getData(dataContext)?.parentOfType(false) 15 | 16 | override fun createHierarchyBrowser(target: PsiElement): HierarchyBrowser { 17 | val browser = ArendClassHierarchyBrowser(target.project, target) 18 | browser.changeView(TypeHierarchyBrowserBase.getSubtypesHierarchyType()) 19 | return browser 20 | } 21 | 22 | override fun browserActivated(hierarchyBrowser: HierarchyBrowser) { 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/hierarchy/clazz/ArendFieldHNodeDescriptor.kt: -------------------------------------------------------------------------------- 1 | package org.arend.hierarchy.clazz 2 | 3 | import com.intellij.icons.AllIcons 4 | import com.intellij.ide.hierarchy.HierarchyNodeDescriptor 5 | import com.intellij.openapi.project.Project 6 | import com.intellij.psi.PsiElement 7 | import com.intellij.ui.RowIcon 8 | import org.arend.hierarchy.ArendHierarchyNodeDescriptor 9 | import org.arend.naming.reference.FieldReferable 10 | import javax.swing.Icon 11 | 12 | class ArendFieldHNodeDescriptor(project: Project, parent: HierarchyNodeDescriptor?, 13 | element: PsiElement, isBase: Boolean, private val isImplemented: Boolean): ArendHierarchyNodeDescriptor(project, parent, element, isBase) { 14 | override fun getIcon(element: PsiElement): Icon? { 15 | val baseIcon = super.getIcon(element) 16 | if (element is FieldReferable) { 17 | return RowIcon(if (isImplemented) AllIcons.Hierarchy.MethodDefined else AllIcons.Hierarchy.MethodNotDefined, baseIcon) 18 | } 19 | return baseIcon 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/highlight/ArendChangeLocalityDetector.kt: -------------------------------------------------------------------------------- 1 | package org.arend.highlight 2 | 3 | import com.intellij.codeInsight.daemon.ChangeLocalityDetector 4 | import com.intellij.psi.PsiElement 5 | import com.intellij.psi.impl.source.tree.LeafPsiElement 6 | import org.arend.psi.* 7 | 8 | class ArendChangeLocalityDetector : ChangeLocalityDetector { 9 | override fun getChangeHighlightingDirtyScopeFor(element: PsiElement): PsiElement? = 10 | when (element) { 11 | is LeafPsiElement -> if (AREND_COMMENTS.contains(element.node.elementType)) element else null 12 | else -> null 13 | } 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/highlight/ArendPassFactoryService.kt: -------------------------------------------------------------------------------- 1 | package org.arend.highlight 2 | 3 | import com.intellij.openapi.components.Service 4 | 5 | @Service(Service.Level.PROJECT) 6 | class ArendPassFactoryService { 7 | @Volatile 8 | var highlightingPassId = -1 9 | 10 | @Volatile 11 | var typecheckerPassId = -1 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/highlight/ArendProblemHighlightFilter.kt: -------------------------------------------------------------------------------- 1 | package org.arend.highlight 2 | 3 | import com.intellij.openapi.util.Condition 4 | import com.intellij.openapi.vfs.VirtualFile 5 | 6 | class ArendProblemHighlightFilter : Condition { 7 | override fun value(t: VirtualFile?): Boolean { 8 | return true 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/highlight/ArendSyntaxHighlighterFactory.kt: -------------------------------------------------------------------------------- 1 | package org.arend.highlight 2 | 3 | import com.intellij.openapi.fileTypes.SyntaxHighlighter 4 | import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory 5 | import com.intellij.openapi.project.Project 6 | import com.intellij.openapi.vfs.VirtualFile 7 | 8 | class ArendSyntaxHighlighterFactory : SyntaxHighlighterFactory() { 9 | override fun getSyntaxHighlighter( 10 | project: Project?, 11 | virtualFile: VirtualFile? 12 | ): SyntaxHighlighter = ArendSyntaxHighlighter() 13 | } 14 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/highlight/ArendTargetElementEvaluator.kt: -------------------------------------------------------------------------------- 1 | package org.arend.highlight 2 | 3 | import com.intellij.codeInsight.TargetElementEvaluatorEx2 4 | import com.intellij.psi.PsiElement 5 | import com.intellij.psi.util.parents 6 | import com.intellij.psi.util.startOffset 7 | import org.arend.psi.ext.ArendDefIdentifier 8 | import org.arend.psi.ext.ArendRefIdentifier 9 | import org.arend.psi.ext.PsiReferable 10 | 11 | class ArendTargetElementEvaluator : TargetElementEvaluatorEx2() { 12 | override fun isAcceptableNamedParent(parent: PsiElement) = 13 | parent !is ArendRefIdentifier && parent !is ArendDefIdentifier 14 | 15 | override fun getNamedElement(element: PsiElement): PsiElement? { 16 | // protection against ArendDefIdentifier, as no references can resolve to it. 17 | return element 18 | .parents(true) 19 | .filter { it is PsiReferable && it !is ArendDefIdentifier } 20 | .firstOrNull() 21 | ?.takeIf { (it as PsiReferable).nameIdentifier?.startOffset == element.startOffset } 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/highlight/EmptyHighlightingPass.kt: -------------------------------------------------------------------------------- 1 | package org.arend.highlight 2 | 3 | import com.intellij.codeHighlighting.TextEditorHighlightingPass 4 | import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerEx 5 | import com.intellij.openapi.editor.Document 6 | import com.intellij.openapi.progress.ProgressIndicator 7 | import com.intellij.openapi.project.Project 8 | 9 | class EmptyHighlightingPass(project: Project, document: Document) : TextEditorHighlightingPass(project, document, false) { 10 | override fun doCollectInformation(progress: ProgressIndicator) {} 11 | 12 | override fun doApplyInformationToEditor() { 13 | DaemonCodeAnalyzerEx.getInstanceEx(myProject).fileStatusMap.markFileUpToDate(document, id) 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/ArendLanguageInjector.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection 2 | 3 | import com.intellij.lang.injection.MultiHostInjector 4 | import com.intellij.lang.injection.MultiHostRegistrar 5 | import com.intellij.psi.PsiElement 6 | import org.arend.ArendLanguage 7 | 8 | 9 | class ArendLanguageInjector : MultiHostInjector { 10 | override fun getLanguagesToInject(registrar: MultiHostRegistrar, context: PsiElement) { 11 | val rangesList = ((context as? PsiInjectionText)?.parent as? PsiInjectionTextFile)?.injectionRanges ?: return 12 | for (ranges in rangesList) { 13 | registrar.startInjecting(ArendLanguage.INSTANCE) 14 | for (range in ranges) { 15 | registrar.addPlace(null, null, context, range) 16 | } 17 | registrar.doneInjecting() 18 | } 19 | } 20 | 21 | override fun elementsToInjectIn() = listOf(PsiInjectionText::class.java) 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/InjectionHighlightingPassFactory.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection 2 | 3 | import com.intellij.codeHighlighting.* 4 | import com.intellij.openapi.editor.Editor 5 | import com.intellij.openapi.project.Project 6 | import com.intellij.openapi.util.TextRange 7 | import org.arend.highlight.BasePassFactory 8 | 9 | class InjectionHighlightingPassFactory : BasePassFactory(PsiInjectionTextFile::class.java), TextEditorHighlightingPassFactoryRegistrar { 10 | private var myPassId = -1 11 | 12 | override fun registerHighlightingPassFactory(registrar: TextEditorHighlightingPassRegistrar, project: Project) { 13 | myPassId = registrar.registerTextEditorHighlightingPass(this, null, null, false, -1) 14 | } 15 | 16 | override fun getPassId() = myPassId 17 | 18 | override fun createPass(file: PsiInjectionTextFile, editor: Editor, textRange: TextRange) = 19 | if (file.hasInjection) InjectionHighlightingPass(file, editor) else null 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/InjectionTextASTFactory.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection 2 | 3 | import com.intellij.lang.ASTFactory 4 | import com.intellij.psi.tree.IElementType 5 | 6 | 7 | class InjectionTextASTFactory : ASTFactory() { 8 | override fun createLeaf(type: IElementType, text: CharSequence) = 9 | if (type == InjectionTextFileElementType.INJECTION_TEXT) PsiInjectionText(text) else null 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/InjectionTextFileElementType.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection 2 | 3 | import com.intellij.lang.ASTFactory 4 | import com.intellij.lang.ASTNode 5 | import com.intellij.psi.tree.IElementType 6 | import com.intellij.psi.tree.IFileElementType 7 | import org.arend.InjectionTextLanguage 8 | 9 | 10 | object InjectionTextFileElementType : IFileElementType("INJECTION_TEXT_FILE", InjectionTextLanguage.INSTANCE) { 11 | val INJECTION_TEXT = IElementType("INJECTION_TEXT", InjectionTextLanguage.INSTANCE) 12 | 13 | override fun parseContents(chameleon: ASTNode) = ASTFactory.leaf(INJECTION_TEXT, chameleon.chars) 14 | } 15 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/InjectionTextFileType.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection 2 | 3 | import com.intellij.openapi.fileTypes.LanguageFileType 4 | import org.arend.InjectionTextLanguage 5 | import javax.swing.Icon 6 | 7 | 8 | class InjectionTextFileType : LanguageFileType(InjectionTextLanguage.INSTANCE) { 9 | override fun getName() = "INJECTION_TEXT" 10 | 11 | override fun getDefaultExtension() = "itxt" 12 | 13 | override fun getDescription() = "Injection text" 14 | 15 | override fun getIcon(): Icon? = null 16 | 17 | companion object { 18 | @JvmField 19 | val INSTANCE = InjectionTextFileType() 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/PsiInjectionText.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection 2 | 3 | import com.intellij.psi.PsiElementVisitor 4 | import com.intellij.psi.PsiLanguageInjectionHost 5 | import com.intellij.psi.impl.source.tree.OwnBufferLeafPsiElement 6 | 7 | 8 | class PsiInjectionText(text: CharSequence) : OwnBufferLeafPsiElement(InjectionTextFileElementType.INJECTION_TEXT, text), PsiLanguageInjectionHost { 9 | override fun isValidHost() = (parent as? PsiInjectionTextFile)?.hasInjection == true 10 | 11 | override fun updateText(text: String) = this 12 | 13 | override fun createLiteralTextEscaper() = TrivialTextEscaper(this) 14 | 15 | override fun accept(visitor: PsiElementVisitor) { 16 | visitor.visitElement(this) 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/PsiInjectionTextDocumentationProvider.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection 2 | 3 | import com.intellij.lang.documentation.AbstractDocumentationProvider 4 | import com.intellij.lang.injection.InjectedLanguageManager 5 | import com.intellij.openapi.editor.Editor 6 | import com.intellij.psi.PsiElement 7 | import com.intellij.psi.PsiFile 8 | 9 | 10 | class PsiInjectionTextDocumentationProvider : AbstractDocumentationProvider() { 11 | override fun getCustomDocumentationElement(editor: Editor, file: PsiFile, contextElement: PsiElement?, targetOffset: Int) = 12 | InjectedLanguageManager.getInstance(file.project).findInjectedElementAt(file, targetOffset)?.parent?.reference?.resolve() 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/PsiInjectionTextFile.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection 2 | 3 | import com.intellij.openapi.util.TextRange 4 | import com.intellij.psi.FileViewProvider 5 | import com.intellij.psi.PsiElementVisitor 6 | import com.intellij.psi.impl.source.PsiFileImpl 7 | import org.arend.core.expr.Expression 8 | import org.arend.naming.scope.EmptyScope 9 | import org.arend.naming.scope.Scope 10 | 11 | 12 | class PsiInjectionTextFile(provider: FileViewProvider) : PsiFileImpl(InjectionTextFileElementType, InjectionTextFileElementType, provider) { 13 | var injectionRanges = ArrayList>() 14 | var injectedExpressions = ArrayList() 15 | var scope: Scope = EmptyScope.INSTANCE 16 | var errorRanges = ArrayList() 17 | 18 | val hasInjection: Boolean 19 | get() = injectionRanges.isNotEmpty() 20 | 21 | override fun accept(visitor: PsiElementVisitor) { 22 | visitor.visitFile(this) 23 | } 24 | 25 | override fun getFileType() = InjectionTextFileType.INSTANCE 26 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/TrivialTextEscaper.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection 2 | 3 | import com.intellij.openapi.util.TextRange 4 | import com.intellij.psi.LiteralTextEscaper 5 | import com.intellij.psi.PsiLanguageInjectionHost 6 | 7 | 8 | class TrivialTextEscaper(host: PsiLanguageInjectionHost) : LiteralTextEscaper(host) { 9 | override fun decode(rangeInsideHost: TextRange, outChars: StringBuilder): Boolean { 10 | outChars.append(myHost.text, rangeInsideHost.startOffset, rangeInsideHost.endOffset) 11 | return true 12 | } 13 | 14 | override fun getOffsetInHost(offsetInDecoded: Int, rangeInsideHost: TextRange) = 15 | rangeInsideHost.startOffset + offsetInDecoded 16 | 17 | override fun isOneLine() = false 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/actions/HideImplicitInformationAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection.actions 2 | 3 | import com.intellij.openapi.actionSystem.ActionUpdateThread 4 | import com.intellij.openapi.actionSystem.AnAction 5 | import com.intellij.openapi.actionSystem.AnActionEvent 6 | import com.intellij.openapi.actionSystem.PlatformDataKeys 7 | import org.arend.injection.InjectedArendEditor 8 | import org.arend.util.isDetailedViewEditor 9 | 10 | class HideImplicitInformationAction : AnAction() { 11 | 12 | override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT 13 | 14 | override fun update(e: AnActionEvent) { 15 | e.presentation.isEnabledAndVisible = e.getData(PlatformDataKeys.EDITOR)?.isDetailedViewEditor() ?: false 16 | } 17 | 18 | override fun actionPerformed(e: AnActionEvent) { 19 | val editor = e.getData(PlatformDataKeys.EDITOR) ?: return 20 | val injectedEditor = editor.getUserData(InjectedArendEditor.AREND_GOAL_EDITOR) ?: return 21 | injectedEditor.performPrettyPrinterManipulation(editor, Choice.HIDE) 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/actions/NormalizationCache.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection.actions 2 | 3 | import org.arend.core.expr.Expression 4 | import org.arend.ext.core.ops.NormalizationMode 5 | import java.util.concurrent.ConcurrentHashMap 6 | 7 | class NormalizationCache { 8 | private val innerCache = ConcurrentHashMap() 9 | 10 | fun getNormalizedExpression(expr: Expression) : Expression { 11 | return if (innerCache.values.any { expr === it}) expr // referential equality is IMPORTANT. equals considers terms to be equal up to normal form. Here we explicitly distinguish nf and non-nf 12 | else innerCache.computeIfAbsent(expr) { it.normalize(NormalizationMode.RNF) } 13 | } 14 | 15 | internal fun enrich(other: NormalizationCache) { 16 | innerCache.putAll(other.innerCache) 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/injection/actions/RevealImplicitInformationAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.injection.actions 2 | 3 | import com.intellij.openapi.actionSystem.ActionUpdateThread 4 | import com.intellij.openapi.actionSystem.AnAction 5 | import com.intellij.openapi.actionSystem.AnActionEvent 6 | import com.intellij.openapi.actionSystem.PlatformDataKeys 7 | import org.arend.injection.InjectedArendEditor 8 | import org.arend.util.isDetailedViewEditor 9 | 10 | class RevealImplicitInformationAction : AnAction() { 11 | 12 | override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT 13 | 14 | override fun update(e: AnActionEvent) { 15 | e.presentation.isEnabledAndVisible = e.getData(PlatformDataKeys.EDITOR)?.isDetailedViewEditor() ?: false 16 | } 17 | 18 | override fun actionPerformed(e: AnActionEvent) { 19 | val editor = e.getData(PlatformDataKeys.EDITOR) ?: return 20 | val injectedEditor = editor.getUserData(InjectedArendEditor.AREND_GOAL_EDITOR) ?: return 21 | injectedEditor.performPrettyPrinterManipulation(editor, Choice.REVEAL) 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/inspection/ArendInspectionBase.kt: -------------------------------------------------------------------------------- 1 | package org.arend.inspection 2 | 3 | import com.intellij.codeInspection.LocalInspectionTool 4 | import com.intellij.codeInspection.ProblemsHolder 5 | import com.intellij.psi.PsiElementVisitor 6 | import org.arend.psi.ArendFile 7 | 8 | abstract class ArendInspectionBase : LocalInspectionTool() { 9 | final override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor = 10 | if ((holder.file as? ArendFile)?.isInjected == true) PsiElementVisitor.EMPTY_VISITOR 11 | else buildArendVisitor(holder, isOnTheFly) 12 | 13 | abstract fun buildArendVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/inspection/ArendInspectionSuppressor.kt: -------------------------------------------------------------------------------- 1 | package org.arend.inspection 2 | 3 | import com.intellij.codeInspection.InspectionSuppressor 4 | import com.intellij.codeInspection.SuppressQuickFix 5 | import com.intellij.psi.PsiElement 6 | import org.arend.psi.ArendFile 7 | 8 | class ArendInspectionSuppressor : InspectionSuppressor { 9 | override fun isSuppressedFor(element: PsiElement, toolId: String): Boolean = 10 | element.containingFile is ArendFile && toolId == "NonAsciiCharacters" 11 | 12 | override fun getSuppressActions(element: PsiElement?, toolId: String): Array = emptyArray() 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/inspection/ArendUnusedImportInspection.kt: -------------------------------------------------------------------------------- 1 | package org.arend.inspection 2 | 3 | import com.intellij.codeInspection.LocalInspectionTool 4 | import com.intellij.codeInspection.ex.UnfairLocalInspectionTool 5 | 6 | class ArendUnusedImportInspection : LocalInspectionTool(), UnfairLocalInspectionTool { 7 | companion object { 8 | const val ID = "ArendUnusedImportInspection" 9 | } 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/intention/ArendIntentionUtils.kt: -------------------------------------------------------------------------------- 1 | package org.arend.intention 2 | 3 | fun checkNotGeneratePreview(): Boolean { 4 | return Thread.currentThread().stackTrace.find { 5 | it.methodName == "generatePreview" && 6 | it.className == "com.intellij.codeInsight.intention.IntentionAction" 7 | } == null 8 | } 9 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/intention/ArendOptimizeImportsQuickFix.kt: -------------------------------------------------------------------------------- 1 | package org.arend.intention 2 | 3 | import com.intellij.codeInspection.LocalQuickFix 4 | import com.intellij.codeInspection.ProblemDescriptor 5 | import com.intellij.openapi.project.Project 6 | import org.arend.codeInsight.ArendImportOptimizer 7 | import org.arend.codeInsight.OptimizationResult 8 | import org.arend.psi.ArendFile 9 | import org.arend.util.ArendBundle 10 | 11 | internal class ArendOptimizeImportsQuickFix(private val optimizationResult: OptimizationResult) : LocalQuickFix { 12 | override fun startInWriteAction(): Boolean = true 13 | 14 | override fun getFamilyName(): String = ArendBundle.message("arend.optimize.imports.intention.family.name") 15 | 16 | override fun getName(): String = ArendBundle.message("arend.optimize.imports.intention.name") 17 | 18 | override fun applyFix(project: Project, descriptor: ProblemDescriptor) { 19 | ArendImportOptimizer().psiModificationRunnable(descriptor.psiElement.containingFile as ArendFile, optimizationResult).run() 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/intention/BaseArendIntention.kt: -------------------------------------------------------------------------------- 1 | package org.arend.intention 2 | 3 | import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction 4 | import com.intellij.codeInsight.intention.impl.BaseIntentionAction 5 | import com.intellij.psi.PsiFile 6 | import org.arend.psi.ArendFile 7 | 8 | abstract class BaseArendIntention(text: String) : PsiElementBaseIntentionAction() { 9 | init { 10 | this.text = text 11 | } 12 | 13 | override fun getFamilyName() = text 14 | 15 | override fun checkFile(file: PsiFile?) = canModify(file) 16 | 17 | companion object { 18 | fun canModify(file: PsiFile?) = file is ArendFile && BaseIntentionAction.canModify(file) && !file.isInjected 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/intention/generating/GenerateMissingClausesIntention.kt: -------------------------------------------------------------------------------- 1 | package org.arend.intention.generating 2 | 3 | import com.intellij.openapi.editor.Editor 4 | import com.intellij.openapi.project.Project 5 | import com.intellij.psi.PsiElement 6 | import org.arend.intention.SelfTargetingIntention 7 | import org.arend.psi.ArendFile 8 | import org.arend.util.ArendBundle 9 | 10 | class GenerateMissingClausesIntention : SelfTargetingIntention(PsiElement::class.java, ArendBundle.message("arend.generatePatternMatchingClauses")) { 11 | override fun isApplicableTo(element: PsiElement, caretOffset: Int, editor: Editor): Boolean { 12 | return checkMissingClauses(element) 13 | } 14 | 15 | override fun applyTo(element: PsiElement, project: Project, editor: Editor) { 16 | val file = element.containingFile as ArendFile 17 | val (group, startOffsetParent) = deleteFunctionBody(element) ?: return 18 | 19 | fixMissingClausesError(project, file, editor, group, startOffsetParent - 1) 20 | } 21 | 22 | override fun startInWriteAction(): Boolean = false 23 | } 24 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/lexer/ArendDocLexerAdapter.kt: -------------------------------------------------------------------------------- 1 | package org.arend.lexer 2 | 3 | import com.intellij.lexer.FlexAdapter 4 | import java.io.Reader 5 | 6 | class ArendDocLexerAdapter : FlexAdapter(ArendDocLexer(null as Reader?)) 7 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/lexer/ArendLexerAdapter.kt: -------------------------------------------------------------------------------- 1 | package org.arend.lexer 2 | 3 | import com.intellij.lexer.FlexAdapter 4 | 5 | class ArendLexerAdapter : FlexAdapter(ArendLexer()) 6 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/ArendFakeRawSource.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module 2 | 3 | import org.arend.ext.module.ModulePath 4 | import org.arend.source.Source 5 | import org.arend.source.SourceLoader 6 | 7 | 8 | class ArendFakeRawSource(private val modulePath: ModulePath): Source { 9 | override fun getModulePath() = modulePath 10 | 11 | override fun load(sourceLoader: SourceLoader) = Source.LoadResult.SUCCESS 12 | 13 | override fun getTimeStamp(): Long = -1 14 | 15 | override fun isAvailable() = true 16 | 17 | override fun toString(): String = modulePath.toString() 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/ArendModuleType.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module 2 | 3 | import com.intellij.openapi.module.Module 4 | import com.intellij.openapi.module.ModuleType 5 | import org.arend.ArendIcons 6 | 7 | class ArendModuleType : ModuleType("AREND_MODULE") { 8 | override fun getNodeIcon(isOpened: Boolean) = ArendIcons.AREND 9 | 10 | override fun createModuleBuilder() = ArendModuleBuilder() 11 | 12 | override fun getDescription() = "Arend library" 13 | 14 | override fun getName() = "Arend" 15 | 16 | companion object { 17 | fun has(module: Module?) = module != null && `is`(module, INSTANCE) 18 | 19 | @JvmField 20 | val INSTANCE = ArendModuleType() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/ArendPreludeScope.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module 2 | 3 | import com.intellij.openapi.components.service 4 | import com.intellij.openapi.project.Project 5 | import com.intellij.psi.PsiManager 6 | import org.arend.naming.reference.Referable 7 | import org.arend.naming.scope.Scope 8 | import org.arend.prelude.Prelude.MODULE_PATH 9 | import org.arend.psi.ext.PsiModuleReferable 10 | import org.arend.typechecking.TypeCheckingService 11 | 12 | class ArendPreludeScope(private val project: Project) : Scope { 13 | override fun getElements(): Collection { 14 | val psiManager = PsiManager.getInstance(project) 15 | val result = ArrayList() 16 | project.service().prelude?.let { psiManager.findFile(it.virtualFile) }?.let { 17 | result.add(PsiModuleReferable(listOf(it), MODULE_PATH)) 18 | } 19 | return result 20 | } 21 | 22 | override fun getElements(kind: Referable.RefKind?): Collection = if (kind == null || kind == Referable.RefKind.EXPR) elements else emptyList() 23 | } 24 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/ArendRawSource.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module 2 | 3 | import org.arend.psi.ArendFile 4 | import org.arend.source.Source 5 | import org.arend.source.SourceLoader 6 | 7 | 8 | class ArendRawSource(private val file: ArendFile): Source { 9 | override fun getModulePath() = file.moduleLocation?.modulePath 10 | 11 | override fun load(sourceLoader: SourceLoader) = Source.LoadResult.SUCCESS 12 | 13 | override fun getTimeStamp() = file.virtualFile?.timeStamp ?: -1 14 | 15 | override fun isAvailable() = file.isValid 16 | 17 | override fun toString() = file.fullName 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/IntellijClassLoaderDelegate.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module 2 | 3 | import com.intellij.openapi.vfs.VirtualFile 4 | import org.arend.library.classLoader.ClassLoaderDelegate 5 | import java.io.IOException 6 | 7 | class IntellijClassLoaderDelegate(private val root: VirtualFile) : ClassLoaderDelegate { 8 | override fun findClass(longName: String): ByteArray? { 9 | var file = root 10 | for (name in (longName.replace('.', '/') + ".class").split('/')) { 11 | file = file.findChild(name) ?: return null 12 | } 13 | 14 | try { 15 | return file.contentsToByteArray() 16 | } catch (e: IOException) { 17 | throw ClassNotFoundException("An exception happened during loading of class $longName", e) 18 | } 19 | } 20 | 21 | override fun toString() = root.path 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/ReloadLibrariesAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module 2 | 3 | import com.intellij.openapi.actionSystem.ActionUpdateThread 4 | import com.intellij.openapi.actionSystem.AnAction 5 | import com.intellij.openapi.actionSystem.AnActionEvent 6 | import com.intellij.openapi.actionSystem.LangDataKeys 7 | import com.intellij.openapi.components.service 8 | import org.arend.typechecking.TypeCheckingService 9 | 10 | 11 | class ReloadLibrariesAction : AnAction("Reload Arend Libraries") { 12 | override fun actionPerformed(e: AnActionEvent) { 13 | e.project?.service()?.reload(true) 14 | } 15 | 16 | override fun getActionUpdateThread() = ActionUpdateThread.BGT 17 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/config/ArendModuleStructureExtension.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module.config 2 | 3 | import com.intellij.openapi.module.Module 4 | import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureExtension 5 | import org.arend.module.editor.ArendModuleConfigurationView 6 | import org.arend.util.allModules 7 | 8 | class ArendModuleStructureExtension : ModuleStructureExtension() { 9 | override fun moduleRemoved(module: Module?) { 10 | val modules = module?.project?.allModules ?: emptyList() 11 | for (otherModule in modules) { 12 | if (module != otherModule) { 13 | ArendModuleConfigurationView.getInstance(otherModule)?.updateAvailableLibrariesAndDependencies() 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/config/EmptyLibraryConfig.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module.config 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.intellij.openapi.vfs.VirtualFile 5 | 6 | 7 | class EmptyLibraryConfig(override val name: String, project: Project) : LibraryConfig(project) { 8 | override val root: VirtualFile? 9 | get() = null 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/editor/ArendModuleConfigEditorProvider.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module.editor 2 | 3 | import com.intellij.openapi.module.ModuleConfigurationEditor 4 | import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationEditorProvider 5 | import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationState 6 | 7 | class ArendModuleConfigEditorProvider: ModuleConfigurationEditorProvider { 8 | override fun createEditors(state: ModuleConfigurationState): Array { 9 | val module = state.currentRootModel?.module 10 | return if (module != null) arrayOf(ArendModuleConfigurationEditor(module)) else emptyArray() 11 | } 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/orderRoot/ArendConfigOrderRootType.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module.orderRoot 2 | 3 | import com.intellij.openapi.roots.OrderRootType 4 | 5 | 6 | class ArendConfigOrderRootType : OrderRootType("AREND_CONFIG") { 7 | companion object { 8 | @JvmField 9 | val INSTANCE = ArendConfigOrderRootType() 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/orderRoot/ArendConfigOrderRootTypeUIFactory.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module.orderRoot 2 | 3 | import com.intellij.openapi.projectRoots.Sdk 4 | import com.intellij.openapi.projectRoots.ui.SdkPathEditor 5 | import com.intellij.openapi.roots.ui.OrderRootTypeUIFactory 6 | import org.arend.ArendIcons 7 | 8 | 9 | class ArendConfigOrderRootTypeUIFactory : OrderRootTypeUIFactory { 10 | override fun getIcon() = ArendIcons.LIBRARY_CONFIG 11 | 12 | override fun getNodeText() = "Arend Library Config File" 13 | 14 | override fun createPathEditor(sdk: Sdk?): SdkPathEditor? = null 15 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/orderRoot/ArendConfigRootDetector.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module.orderRoot 2 | 3 | import com.intellij.openapi.progress.ProgressIndicator 4 | import com.intellij.openapi.roots.libraries.ui.RootDetector 5 | import com.intellij.openapi.vfs.JarFileSystem 6 | import com.intellij.openapi.vfs.VirtualFile 7 | import org.arend.util.FileUtils 8 | 9 | 10 | object ArendConfigRootDetector : RootDetector(ArendConfigOrderRootType.INSTANCE, false, "Arend Library Config File") { 11 | override fun detectRoots(rootCandidate: VirtualFile, progressIndicator: ProgressIndicator): List = 12 | if (rootCandidate.isDirectory) { 13 | rootCandidate.findChild(FileUtils.LIBRARY_CONFIG_FILE)?.let { listOf(it) } ?: emptyList() 14 | } else { 15 | if (rootCandidate.name == FileUtils.LIBRARY_CONFIG_FILE) listOf(rootCandidate) 16 | else JarFileSystem.getInstance().getJarRootForLocalFile(rootCandidate)?.findChild(FileUtils.LIBRARY_CONFIG_FILE)?.let { listOf(it) } ?: emptyList() 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/module/starter/ArendStarterSettings.kt: -------------------------------------------------------------------------------- 1 | package org.arend.module.starter 2 | 3 | import com.intellij.ide.starters.shared.StarterLanguage 4 | 5 | val AREND_STARTER_LANGUAGE: StarterLanguage = StarterLanguage("arend", "Arend", "arend") 6 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/navigation/ArendClassNavigationContributor.kt: -------------------------------------------------------------------------------- 1 | package org.arend.navigation 2 | 3 | import com.intellij.openapi.project.Project 4 | import org.arend.psi.ext.PsiLocatedReferable 5 | import org.arend.psi.ext.PsiReferable 6 | import org.arend.psi.stubs.index.ArendGotoClassIndex 7 | 8 | class ArendClassNavigationContributor : ArendNavigationContributorBase( 9 | ArendGotoClassIndex.KEY, 10 | PsiReferable::class.java 11 | ) { 12 | override fun getGeneratedItems(project: Project?): Map> = emptyMap() 13 | } 14 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ArendCompositeElementType.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi 2 | 3 | import com.intellij.psi.tree.IElementType 4 | import org.arend.ArendLanguage 5 | 6 | class ArendCompositeElementType(debugName: String) : IElementType(debugName, ArendLanguage.INSTANCE) 7 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ArendFileScope.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.intellij.openapi.vfs.VirtualFile 5 | import com.intellij.psi.PsiManager 6 | import com.intellij.psi.search.ProjectAndLibrariesScope 7 | import org.arend.prelude.Prelude 8 | 9 | class ArendFileScope(project: Project): ProjectAndLibrariesScope(project) { 10 | override fun contains(file: VirtualFile): Boolean { 11 | val project = project ?: return false 12 | val psiFile = PsiManager.getInstance(project).findFile(file) as? ArendFile ?: return false 13 | if (psiFile.libraryName == Prelude.LIBRARY_NAME) { 14 | return true 15 | } 16 | if (!super.contains(file)) return false 17 | return psiFile.moduleLocation != null 18 | } 19 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ClassReferenceHolder.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi 2 | 3 | import org.arend.naming.reference.ClassReferable 4 | import org.arend.naming.reference.LocatedReferable 5 | import org.arend.psi.ext.ArendCompositeElement 6 | import org.arend.term.abs.Abstract 7 | 8 | 9 | interface ClassReferenceHolder : Abstract.ClassReferenceHolder, ArendCompositeElement { 10 | // If onlyClassRef is true, getClassReferenceData will try to infer classRef from the type of a referable if it is not a class already. 11 | // This is required for expressions of the form \new c { ... }, where c is an instance of a class. 12 | fun getClassReferenceData(onlyClassRef: Boolean): ClassReferenceData? 13 | } 14 | 15 | class ClassReferenceData( 16 | val classRef: ClassReferable, 17 | val argumentsExplicitness: List, 18 | val implementedFields: Set, 19 | val withTailImplicits: Boolean) -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/SourceInfoErrorData.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi 2 | 3 | import com.intellij.openapi.application.runReadAction 4 | import com.intellij.psi.PsiErrorElement 5 | import org.arend.ext.error.SourceInfo 6 | import org.arend.ext.reference.DataContainer 7 | import org.arend.psi.ext.moduleTextRepresentationImpl 8 | import org.arend.psi.ext.positionTextRepresentationImpl 9 | 10 | class SourceInfoErrorData(private val cause: PsiErrorElement) : SourceInfo, DataContainer { 11 | override fun getData(): Any = cause 12 | 13 | override fun moduleTextRepresentation(): String? = runReadAction { cause.moduleTextRepresentationImpl() } 14 | 15 | override fun positionTextRepresentation(): String? = runReadAction { cause.positionTextRepresentationImpl() } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/doc/ArendDocCodeBlock.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.doc 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.ext.ArendCompositeElementImpl 5 | 6 | class ArendDocCodeBlock(node: ASTNode) : ArendCompositeElementImpl(node) 7 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/doc/ArendDocReference.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.doc 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.naming.scope.EmptyScope 5 | import org.arend.naming.scope.Scope 6 | import org.arend.psi.ancestor 7 | import org.arend.psi.ext.ArendCompositeElementImpl 8 | import org.arend.psi.ext.ArendGroup 9 | import org.arend.psi.ext.ArendLongName 10 | import org.arend.psi.childOfType 11 | import org.arend.psi.childOfTypeStrict 12 | 13 | class ArendDocReference(node: ASTNode) : ArendCompositeElementImpl(node) { 14 | val docReferenceText: ArendDocReferenceText? 15 | get() = childOfType() 16 | 17 | val longName: ArendLongName 18 | get() = childOfTypeStrict() 19 | 20 | override val scope: Scope = 21 | ArendDocComment.getScope(ancestor()?.owner) ?: ancestor()?.scope ?: EmptyScope.INSTANCE 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/doc/ArendDocReferenceText.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.doc 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.ext.ArendCompositeElementImpl 5 | 6 | class ArendDocReferenceText(node: ASTNode) : ArendCompositeElementImpl(node) 7 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendAccessMod.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.ArendElementTypes.PRIVATE_KW 5 | import org.arend.psi.ArendElementTypes.PROTECTED_KW 6 | import org.arend.psi.hasChildOfType 7 | import org.arend.term.group.AccessModifier 8 | 9 | class ArendAccessMod(node: ASTNode) : ArendSourceNodeImpl(node) { 10 | val accessModifier: AccessModifier 11 | get() = when { 12 | hasChildOfType(PRIVATE_KW) -> AccessModifier.PRIVATE 13 | hasChildOfType(PROTECTED_KW) -> AccessModifier.PROTECTED 14 | else -> AccessModifier.PUBLIC 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendAlias.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | 6 | class ArendAlias(node: ASTNode) : ArendCompositeElementImpl(node) { 7 | val aliasIdentifier: ArendAliasIdentifier? 8 | get() = childOfType() 9 | 10 | val prec: ArendPrec? 11 | get() = childOfType() 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendAppExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.term.abs.AbstractExpressionVisitor 5 | 6 | 7 | open class ArendAppExpr(node: ASTNode) : ArendExpr(node) { 8 | override fun

accept(visitor: AbstractExpressionVisitor, params: P?): R = 9 | visitor.visitInferHole(this, params) 10 | } 11 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendAppPrefix.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.util.elementType 5 | import org.arend.psi.ArendElementTypes.* 6 | import org.arend.psi.firstRelevantChild 7 | import org.arend.psi.hasChildOfType 8 | import org.arend.term.abs.Abstract 9 | 10 | class ArendAppPrefix(node: ASTNode) : ArendCompositeElementImpl(node) { 11 | val isNew: Boolean 12 | get() = firstRelevantChild.elementType == NEW_KW 13 | 14 | val evalKind: Abstract.EvalKind? 15 | get() = if (hasChildOfType(EVAL_KW)) Abstract.EvalKind.EVAL else 16 | when (firstRelevantChild.elementType) { 17 | PEVAL_KW -> Abstract.EvalKind.PEVAL 18 | BOX_KW -> Abstract.EvalKind.BOX 19 | else -> null 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendArgumentAppExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.term.abs.AbstractExpressionVisitor 5 | import org.arend.psi.firstRelevantChild 6 | import org.arend.psi.childOfType 7 | import org.arend.psi.getChildrenOfType 8 | 9 | 10 | class ArendArgumentAppExpr(node: ASTNode) : ArendAppExpr(node) { 11 | val argumentList: List 12 | get() = getChildrenOfType() 13 | 14 | val longNameExpr: ArendLongNameExpr? 15 | get() = childOfType() 16 | 17 | val atomFieldsAcc: ArendAtomFieldsAcc? 18 | get() = childOfType() 19 | 20 | override fun

accept(visitor: AbstractExpressionVisitor, params: P?): R { 21 | val expr = firstRelevantChild as? ArendExpr ?: error("Incomplete expression: $this") 22 | val args = argumentList 23 | return if (args.isEmpty()) expr.accept(visitor, params) else visitor.visitBinOpSequence(this, expr, args, params) 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendArrExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | import org.arend.term.abs.AbstractExpressionVisitor 6 | 7 | 8 | class ArendArrExpr(node: ASTNode) : ArendExpr(node) { 9 | val domain: ArendExpr? 10 | get() = childOfType() 11 | 12 | val codomain: ArendExpr? 13 | get() = childOfType(1) 14 | 15 | override fun

accept(visitor: AbstractExpressionVisitor, params: P?): R { 16 | val domain = domain 17 | return visitor.visitPi(this, if (domain == null) emptyList() else listOf(domain), codomain, params) 18 | } 19 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendAsPattern.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | import org.arend.term.abs.Abstract 6 | 7 | 8 | class ArendAsPattern(node: ASTNode) : ArendSourceNodeImpl(node), Abstract.TypedReferable { 9 | override fun getData() = this 10 | 11 | override fun getReferable(): ArendDefIdentifier? = childOfType() 12 | 13 | override fun getType(): ArendExpr? = childOfType() 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendAtomFieldsAcc.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.psi.childOfTypeStrict 7 | import org.arend.psi.getChildrenOfType 8 | import org.arend.term.abs.AbstractExpressionVisitor 9 | 10 | 11 | class ArendAtomFieldsAcc(node: ASTNode) : ArendExpr(node) { 12 | val atom: ArendAtom 13 | get() = childOfTypeStrict() 14 | 15 | val numberList: List 16 | get() = getChildrenOfType(ArendElementTypes.NUMBER) 17 | 18 | override fun

accept(visitor: AbstractExpressionVisitor, params: P?): R { 19 | val fieldAccs = numberList.map { it.text.toInt() } 20 | return if (fieldAccs.isEmpty()) { 21 | atom.accept(visitor, params) 22 | } else { 23 | visitor.visitFieldAccs(this, atom, fieldAccs, params) 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendAtomOnlyLevelExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.util.elementType 5 | import org.arend.psi.ArendElementTypes.* 6 | import org.arend.psi.firstRelevantChild 7 | import org.arend.psi.childOfType 8 | import org.arend.term.abs.Abstract 9 | import org.arend.term.abs.AbstractLevelExpressionVisitor 10 | 11 | 12 | class ArendAtomOnlyLevelExpr(node: ASTNode) : ArendOnlyLevelExpr(node), ArendTopLevelLevelExpr, Abstract.LevelExpression { 13 | override fun getData() = this 14 | 15 | override fun

accept(visitor: AbstractLevelExpressionVisitor, params: P?): R = 16 | when (firstRelevantChild.elementType) { 17 | LP_KW -> visitor.visitLP(this, params) 18 | LH_KW -> visitor.visitLH(this, params) 19 | OO_KW -> visitor.visitInf(this, params) 20 | else -> { 21 | val child = childOfType() 22 | if (child != null) child.accept(visitor, params) else visitor.visitError(this, params) 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendCaseArg.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.* 6 | import org.arend.psi.ArendElementTypes.* 7 | import org.arend.term.abs.Abstract 8 | 9 | 10 | class ArendCaseArg(node: ASTNode) : ArendSourceNodeImpl(node), Abstract.CaseArgument { 11 | val colon: PsiElement? 12 | get() = findChildByType(COLON) 13 | 14 | val asKw: PsiElement? 15 | get() = findChildByType(AS_KW) 16 | 17 | val elimKw: PsiElement? 18 | get() = findChildByType(ELIM_KW) 19 | 20 | override fun getApplyHoleData(): PsiElement? = findChildByType(APPLY_HOLE) 21 | 22 | override fun getExpression(): ArendExpr? = childOfType() 23 | 24 | override fun getReferable(): ArendDefIdentifier? = childOfType() 25 | 26 | override fun getType(): ArendExpr? = colon?.findNextSibling() as? ArendExpr 27 | 28 | override fun getEliminatedReference(): ArendRefIdentifier? = childOfType() 29 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendClassStat.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.psi.childOfType 7 | import org.arend.psi.hasChildOfType 8 | 9 | class ArendClassStat(node: ASTNode) : ArendCompositeElementImpl(node) { 10 | val classField: ArendClassField? 11 | get() = childOfType() 12 | 13 | val classImplement: ArendClassImplement? 14 | get() = childOfType() 15 | 16 | val overriddenField: ArendOverriddenField? 17 | get() = childOfType() 18 | 19 | val coClause: ArendCoClause? 20 | get() = childOfType() 21 | 22 | val definition: ArendDefinition<*>? 23 | get() = childOfType() 24 | 25 | val group: ArendGroup? 26 | get() = childOfType() 27 | 28 | val isDefault: Boolean 29 | get() = hasChildOfType(ArendElementTypes.DEFAULT_KW) 30 | 31 | val propertyKw: PsiElement? 32 | get() = findChildByType(ArendElementTypes.PROPERTY_KW) 33 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendClause.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.term.abs.Abstract 7 | import org.arend.psi.childOfType 8 | import org.arend.psi.getChildrenOfType 9 | 10 | 11 | class ArendClause(node: ASTNode) : ArendSourceNodeImpl(node), Abstract.FunctionClause { 12 | val fatArrow: PsiElement? 13 | get() = findChildByType(ArendElementTypes.FAT_ARROW) 14 | 15 | override fun getData() = this 16 | 17 | override fun getPatterns(): List = getChildrenOfType() 18 | 19 | override fun getExpression(): ArendExpr? = childOfType() 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendCoClause.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | import org.arend.psi.childOfTypeStrict 6 | import org.arend.term.abs.Abstract 7 | 8 | 9 | class ArendCoClause(node: ASTNode) : ArendLocalCoClause(node), Abstract.CoClauseFunctionReference, ArendStatement { 10 | val defIdentifier: ArendDefIdentifier? 11 | get() = childOfType() 12 | 13 | override val longName: ArendLongName 14 | get() = childOfTypeStrict() 15 | 16 | override fun getFunctionReference(): ArendCoClauseDef? = 17 | if (parent !is ArendClassStat || defIdentifier != null || group?.returnExpr != null) group else null 18 | 19 | override fun isDefault() = (parent as? ArendClassStat)?.isDefault == true 20 | 21 | override fun getGroup(): ArendCoClauseDef? = childOfType() 22 | 23 | override fun getNamespaceCommand(): ArendStatCmd? = null 24 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendConstructorClause.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.util.PsiTreeUtil 5 | import org.arend.psi.getChildrenOfType 6 | import org.arend.term.abs.Abstract 7 | 8 | 9 | class ArendConstructorClause(node: ASTNode) : ArendSourceNodeImpl(node), Abstract.ConstructorClause { 10 | override fun getData(): ArendConstructorClause = this 11 | 12 | override fun getPatterns(): List = PsiTreeUtil.getChildrenOfTypeAsList(this, ArendPattern::class.java) 13 | 14 | override fun getConstructors(): List = getChildrenOfType() 15 | 16 | override fun isLocal() = false 17 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendDataBody.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | import org.arend.psi.getChildrenOfType 6 | 7 | class ArendDataBody(node: ASTNode) : ArendCompositeElementImpl(node) { 8 | val elim: ArendElim? 9 | get() = childOfType() 10 | 11 | val constructorClauseList: List 12 | get() = getChildrenOfType() 13 | 14 | val constructorList: List 15 | get() = getChildrenOfType() 16 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendElim.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.psi.getChildrenOfType 7 | 8 | class ArendElim(node: ASTNode) : ArendCompositeElementImpl(node) { 9 | val refIdentifierList: List 10 | get() = getChildrenOfType() 11 | 12 | val elimKw: PsiElement? 13 | get() = findChildByType(ArendElementTypes.ELIM_KW) 14 | 15 | val withKw: PsiElement? 16 | get() = findChildByType(ArendElementTypes.WITH_KW) 17 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.term.abs.Abstract 5 | import org.arend.term.abs.AbstractExpressionVisitor 6 | import java.lang.IllegalStateException 7 | 8 | 9 | open class ArendExpr(node: ASTNode) : ArendSourceNodeImpl(node), Abstract.Expression, Abstract.Parameter { 10 | override fun getData() = this 11 | 12 | override fun isExplicit() = true 13 | 14 | override fun getReferableList() = listOf(null) 15 | 16 | override fun getType() = this 17 | 18 | override fun isStrict() = false 19 | 20 | override fun isProperty() = false 21 | 22 | override fun

accept(visitor: AbstractExpressionVisitor, params: P?): R { 23 | throw IllegalStateException() 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendFunctionClauses.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.psi.getChildrenOfType 7 | 8 | class ArendFunctionClauses(node: ASTNode) : ArendCompositeElementImpl(node) { 9 | val clauseList: List 10 | get() = getChildrenOfType() 11 | 12 | val lbrace: PsiElement? 13 | get() = findChildByType(ArendElementTypes.LBRACE) 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendGoal.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | 6 | class ArendGoal(node: ASTNode) : PsiReferableImpl(node) { 7 | val defIdentifier: ArendDefIdentifier? 8 | get() = childOfType() 9 | 10 | val expr: ArendExpr? 11 | get() = childOfType() 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendIdentifierOrUnknown.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | 6 | class ArendIdentifierOrUnknown(node: ASTNode) : ArendCompositeElementImpl(node) { 7 | val defIdentifier: ArendDefIdentifier? 8 | get() = childOfType() 9 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendLamExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.* 6 | import org.arend.term.abs.Abstract 7 | import org.arend.term.abs.AbstractExpressionVisitor 8 | 9 | class ArendLamExpr(node: ASTNode) : ArendExpr(node), Abstract.LamParametersHolder { 10 | val lamParamList: List 11 | get() = getChildrenOfType() 12 | 13 | val body: ArendExpr? 14 | get() = childOfType() 15 | 16 | val fatArrow: PsiElement? 17 | get() = findChildByType(ArendElementTypes.FAT_ARROW) 18 | 19 | override fun

accept(visitor: AbstractExpressionVisitor, params: P?): R = 20 | visitor.visitLam(this, lamParamList, body, params) 21 | 22 | override fun getParameters() = lamParamList.filterIsInstance() 23 | 24 | override fun getLamParameters() = lamParamList 25 | } 26 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendLamParam.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.term.abs.Abstract 5 | 6 | open class ArendLamParam(node: ASTNode) : ArendSourceNodeImpl(node), Abstract.LamParameter { 7 | override fun getData() = this 8 | } 9 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendLetExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import com.intellij.psi.util.elementType 6 | import org.arend.psi.* 7 | import org.arend.psi.ArendElementTypes.* 8 | import org.arend.term.abs.Abstract 9 | import org.arend.term.abs.AbstractExpressionVisitor 10 | 11 | class ArendLetExpr(node: ASTNode) : ArendExpr(node), Abstract.LetClausesHolder { 12 | val expr: ArendExpr? 13 | get() = childOfType() 14 | 15 | val inKw: PsiElement? 16 | get() = findChildByType(IN_KW) 17 | 18 | override fun getLetClauses(): List = getChildrenOfType() 19 | 20 | override fun

accept(visitor: AbstractExpressionVisitor, params: P?): R { 21 | val type = firstRelevantChild.elementType 22 | return visitor.visitLet(this, type == HAVE_KW || type == HAVES_KW, type == HAVES_KW || type == LETS_KW, letClauses, expr, params) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendLevelCmp.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.util.elementType 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.psi.firstRelevantChild 7 | 8 | class ArendLevelCmp(node: ASTNode) : ArendCompositeElementImpl(node) { 9 | val isIncreasing: Boolean 10 | get() = firstRelevantChild.elementType != ArendElementTypes.GREATER_OR_EQUALS 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendLevelExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import org.arend.term.abs.AbstractLevelExpressionVisitor 4 | import com.intellij.lang.ASTNode 5 | import com.intellij.psi.util.elementType 6 | import org.arend.psi.ArendElementTypes 7 | import org.arend.psi.firstRelevantChild 8 | import org.arend.psi.childOfType 9 | import org.arend.term.abs.Abstract 10 | 11 | 12 | open class ArendLevelExpr(node: ASTNode) : ArendSourceNodeImpl(node), Abstract.LevelExpression { 13 | override fun getData() = this 14 | 15 | override fun

accept(visitor: AbstractLevelExpressionVisitor, params: P?): R = when (firstRelevantChild.elementType) { 16 | ArendElementTypes.SUC_KW -> visitor.visitSuc(this, childOfType(), params) 17 | ArendElementTypes.MAX_KW -> visitor.visitMax(this, childOfType(), childOfType(1), params) 18 | else -> error("Unknown ArendLevelExpr") 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendLevelParamsSeq.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | import org.arend.psi.getChildrenOfType 6 | import org.arend.term.abs.Abstract 7 | 8 | class ArendLevelParamsSeq(node: ASTNode) : ArendCompositeElementImpl(node), Abstract.LevelParameters { 9 | override fun getData() = this 10 | 11 | override fun getReferables(): List = getChildrenOfType() 12 | 13 | override fun getComparisonList(): List = getChildrenOfType().map { 14 | if (it.isIncreasing) Abstract.Comparison.LESS_OR_EQUALS else Abstract.Comparison.GREATER_OR_EQUALS 15 | } 16 | 17 | override fun isIncreasing() = childOfType()?.isIncreasing != false 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendLevelsExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.psi.childOfType 7 | 8 | class ArendLevelsExpr(node: ASTNode) : ArendCompositeElementImpl(node) { 9 | val levelsExpr: ArendLevelsExpr? 10 | get() = childOfType() 11 | 12 | val pLevelExprs: ArendMaybeAtomLevelExprs? 13 | get() = childOfType() 14 | 15 | val hLevelExprs: ArendMaybeAtomLevelExprs? 16 | get() = childOfType(1) 17 | 18 | val levelsKw: PsiElement? 19 | get() = findChildByType(ArendElementTypes.LEVELS_KW) 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendLocalCoClause.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | 5 | open class ArendLocalCoClause(node: ASTNode) : ArendSourceNodeImpl(node), CoClauseBase { 6 | override fun getData() = this 7 | 8 | override fun getPrec(): ArendPrec? = null 9 | 10 | override fun getImplementedField() = longName 11 | 12 | override fun getCoClauseElements(): List = localCoClauseList 13 | 14 | override fun getParameters(): List = lamParamList.filterIsInstance() 15 | 16 | override fun getLamParameters(): List = lamParamList 17 | 18 | override fun getImplementation(): ArendExpr? = expr 19 | 20 | override fun hasImplementation() = fatArrow != null 21 | 22 | override fun getCoClauseData() = lbrace 23 | 24 | override fun getClassReference() = CoClauseBase.getClassReference(this) 25 | 26 | override fun getClassReferenceData(onlyClassRef: Boolean) = CoClauseBase.getClassReferenceData(this) 27 | 28 | override fun isDefault() = false 29 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendMaybeAtomLevelExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | 6 | class ArendMaybeAtomLevelExpr(node: ASTNode) : ArendCompositeElementImpl(node) { 7 | val atomLevelExpr: ArendAtomLevelExpr? 8 | get() = childOfType() 9 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendMaybeAtomLevelExprs.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | import org.arend.psi.getChildrenOfType 6 | 7 | class ArendMaybeAtomLevelExprs(node: ASTNode) : ArendCompositeElementImpl(node), ArendTopLevelLevelExpr { 8 | val levelExprList: List 9 | get() = maybeAtomLevelExpr?.atomLevelExpr?.let { listOf(it) } ?: getChildrenOfType() 10 | 11 | private val maybeAtomLevelExpr: ArendMaybeAtomLevelExpr? 12 | get() = childOfType() 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendNsId.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.naming.reference.Referable 6 | import org.arend.psi.ArendElementTypes 7 | import org.arend.psi.childOfType 8 | import org.arend.psi.childOfTypeStrict 9 | import org.arend.term.NameRenaming 10 | 11 | 12 | class ArendNsId(node: ASTNode) : ArendCompositeElementImpl(node), NameRenaming { 13 | val refIdentifier: ArendRefIdentifier 14 | get() = childOfTypeStrict() 15 | 16 | val defIdentifier: ArendDefIdentifier? 17 | get() = childOfType() 18 | 19 | val prec: ArendPrec? 20 | get() = childOfType() 21 | 22 | val asKw: PsiElement? 23 | get() = findChildByType(ArendElementTypes.AS_KW) 24 | 25 | override fun getOldReference(): Referable = refIdentifier.referent 26 | 27 | override fun getName() = defIdentifier?.referenceName 28 | 29 | override fun getPrecedence() = ReferableBase.calcPrecedence(prec) 30 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendNsUsing.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes.* 6 | import org.arend.psi.getChildrenOfType 7 | 8 | class ArendNsUsing(node: ASTNode) : ArendCompositeElementImpl(node) { 9 | val lparen: PsiElement? 10 | get() = findChildByType(LPAREN) 11 | 12 | val rparen: PsiElement? 13 | get() = findChildByType(RPAREN) 14 | 15 | val usingKw: PsiElement? 16 | get() = findChildByType(USING_KW) 17 | 18 | val nsIdList: List 19 | get() = getChildrenOfType() 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendOnlyLevelExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.util.elementType 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.psi.firstRelevantChild 7 | import org.arend.psi.childOfType 8 | import org.arend.term.abs.Abstract 9 | import org.arend.term.abs.AbstractLevelExpressionVisitor 10 | 11 | 12 | open class ArendOnlyLevelExpr(node: ASTNode) : ArendSourceNodeImpl(node), Abstract.LevelExpression { 13 | fun getAtomLevelExpr(index: Int): ArendAtomLevelExpr? = childOfType(index) 14 | 15 | override fun getData() = this 16 | 17 | override fun

accept(visitor: AbstractLevelExpressionVisitor, params: P?): R = 18 | when (firstRelevantChild.elementType) { 19 | ArendElementTypes.SUC_KW -> visitor.visitSuc(this, getAtomLevelExpr(0), params) 20 | ArendElementTypes.MAX_KW -> visitor.visitMax(this, getAtomLevelExpr(0), getAtomLevelExpr(1), params) 21 | else -> error("Incomplete expression: $this") 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendOverriddenField.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | import org.arend.psi.getChildrenOfType 6 | import org.arend.term.abs.Abstract 7 | 8 | class ArendOverriddenField(node: ASTNode) : ArendSourceNodeImpl(node), Abstract.OverriddenField { 9 | val returnExpr: ArendReturnExpr? 10 | get() = childOfType() 11 | 12 | override fun getData() = this 13 | 14 | override fun getOverriddenField(): ArendLongName? = childOfType() 15 | 16 | override fun getParameters(): List = getChildrenOfType() 17 | 18 | override fun getResultType(): ArendExpr? = returnExpr?.type 19 | 20 | override fun getResultTypeLevel(): ArendExpr? = returnExpr?.typeLevel 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendPiExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.term.abs.Abstract 5 | import org.arend.term.abs.AbstractExpressionVisitor 6 | import org.arend.psi.childOfType 7 | import org.arend.psi.getChildrenOfType 8 | 9 | class ArendPiExpr(node: ASTNode) : ArendExpr(node), Abstract.ParametersHolder { 10 | val codomain: ArendExpr? 11 | get() = childOfType() 12 | 13 | override fun

accept(visitor: AbstractExpressionVisitor, params: P?): R = 14 | visitor.visitPi(this, parameters, codomain, params) 15 | 16 | override fun getParameters(): List = getChildrenOfType() 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendPrec.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes 6 | 7 | class ArendPrec(node: ASTNode) : ArendCompositeElementImpl(node) { 8 | val number: PsiElement? 9 | get() = findChildByType(ArendElementTypes.NUMBER) 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendReferenceContainer.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.psi.PsiElement 4 | import org.arend.naming.reference.UnresolvedReference 5 | 6 | interface ArendReferenceContainer : ArendCompositeElement { 7 | val referenceNameElement: ArendCompositeElement? 8 | val referenceName: String 9 | val longName: List 10 | val unresolvedReference: UnresolvedReference? 11 | val resolve: PsiElement? 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendReferenceElement.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.openapi.util.TextRange 4 | 5 | interface ArendReferenceElement : ArendReferenceContainer { 6 | val rangeInElement: TextRange 7 | } 8 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendReplLine.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.psi.childOfType 7 | 8 | class ArendReplLine(node: ASTNode) : ArendCompositeElementImpl(node) { 9 | val expr: ArendExpr? 10 | get() = childOfType() 11 | 12 | val replCommand: PsiElement? 13 | get() = findChildByType(ArendElementTypes.REPL_COMMAND) 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendReturnExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.psi.childOfType 7 | 8 | class ArendReturnExpr(node: ASTNode) : ArendCompositeElementImpl(node) { 9 | val type: ArendExpr? 10 | get() = childOfType() 11 | 12 | val typeLevel: ArendExpr? 13 | get() = childOfType(1) 14 | 15 | val levelKw: PsiElement? 16 | get() = findChildByType(ArendElementTypes.LEVEL_KW) 17 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendSigmaExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.term.abs.Abstract 5 | import org.arend.term.abs.AbstractExpressionVisitor 6 | import org.arend.psi.getChildrenOfType 7 | 8 | class ArendSigmaExpr(node: ASTNode) : ArendExpr(node), Abstract.ParametersHolder { 9 | override fun

accept(visitor: AbstractExpressionVisitor, params: P?): R = 10 | visitor.visitSigma(this, parameters, params) 11 | 12 | override fun getParameters(): List = getChildrenOfType() 13 | } 14 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendStat.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.util.elementType 5 | import org.arend.psi.* 6 | 7 | class ArendStat(node: ASTNode) : ArendSourceNodeImpl(node), ArendStatement { 8 | val statCmd: ArendStatCmd? 9 | get() = childOfType() 10 | 11 | val statAccessMod: ArendStatAccessMod? 12 | get() = childOfType() 13 | 14 | override fun getGroup(): ArendGroup? = childOfType() 15 | 16 | override fun getNamespaceCommand(): ArendStatCmd? = childOfType() 17 | 18 | override fun getPLevelsDefinition(): ArendLevelParamsSeq? = getChild { it.elementType == ArendElementTypes.P_LEVEL_PARAMS_SEQ } 19 | 20 | override fun getHLevelsDefinition(): ArendLevelParamsSeq? = getChild { it.elementType == ArendElementTypes.H_LEVEL_PARAMS_SEQ } 21 | 22 | companion object { 23 | fun flatStatements(l: List?): List = l?.flatMap { 24 | val accessMod = it.statAccessMod 25 | if (accessMod == null) listOf(it) else flatStatements(accessMod.statList) 26 | } ?: emptyList() 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendStatAccessMod.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfTypeStrict 5 | import org.arend.psi.getChildrenOfType 6 | 7 | class ArendStatAccessMod(node: ASTNode) : ArendSourceNodeImpl(node) { 8 | val accessModifier 9 | get() = childOfTypeStrict().accessModifier 10 | 11 | val statList: List 12 | get() = getChildrenOfType() 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendSuperClass.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | import org.arend.psi.childOfTypeStrict 6 | import org.arend.term.abs.Abstract 7 | 8 | class ArendSuperClass(node: ASTNode) : ArendSourceNodeImpl(node), Abstract.ReferenceExpression { 9 | val longName: ArendLongName 10 | get() = childOfTypeStrict() 11 | 12 | override fun getData() = this 13 | 14 | override fun getReferent() = longName.referent 15 | 16 | private fun getLevels(index: Int) = childOfType(index)?.levelExprList 17 | 18 | override fun getPLevels(): List? = getLevels(0) 19 | 20 | override fun getHLevels(): List? = getLevels(1) 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendTopLevelLevelExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.psi.PsiElement 4 | import org.arend.psi.findPrevSibling 5 | 6 | interface ArendTopLevelLevelExpr : PsiElement { 7 | fun isPLevels(): Boolean { 8 | var expr: PsiElement? = this 9 | var parent = parent 10 | while (parent is ArendOnlyLevelExpr) { 11 | expr = parent.parent 12 | parent = expr?.parent 13 | } 14 | return expr?.findPrevSibling()?.javaClass != javaClass 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendTuple.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.term.abs.AbstractExpressionVisitor 7 | import org.arend.psi.getChildrenOfType 8 | 9 | class ArendTuple(node: ASTNode) : ArendExpr(node) { 10 | val tupleExprList: List 11 | get() = getChildrenOfType() 12 | 13 | val lparen: PsiElement? 14 | get() = findChildByType(ArendElementTypes.LPAREN) 15 | 16 | override fun

accept(visitor: AbstractExpressionVisitor, params: P?): R = 17 | acceptTupleExpression(this, tupleExprList, visitor, params) 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendTypedExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.childOfType 5 | import org.arend.psi.getChildrenOfType 6 | 7 | class ArendTypedExpr(node: ASTNode) : ArendCompositeElementImpl(node) { 8 | val identifierOrUnknownList: List 9 | get() = getChildrenOfType() 10 | 11 | val type: ArendExpr? 12 | get() = childOfType() 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendUniverseExpr.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.arend.psi.firstRelevantChild 5 | import org.arend.term.abs.AbstractExpressionVisitor 6 | 7 | 8 | class ArendUniverseExpr(node: ASTNode) : ArendExpr(node) { 9 | override fun

accept(visitor: AbstractExpressionVisitor, params: P?): R { 10 | val child = firstRelevantChild ?: error ("Incorrect expression: universeExpr") 11 | return if (child is ArendAppExpr) child.accept(visitor, params) else visitor.visitUniverse(this, 0, -1, null, null, params) 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendWhere.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes.* 6 | import org.arend.psi.getChildrenOfType 7 | 8 | class ArendWhere(node: ASTNode) : ArendCompositeElementImpl(node) { 9 | val statList: List 10 | get() = getChildrenOfType() 11 | 12 | val lbrace: PsiElement? 13 | get() = findChildByType(LBRACE) 14 | 15 | val rbrace: PsiElement? 16 | get() = findChildByType(RBRACE) 17 | 18 | val whereKw: PsiElement? 19 | get() = findChildByType(WHERE_KW) 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/ArendWithBody.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.arend.psi.ArendElementTypes 6 | import org.arend.psi.childOfTypeStrict 7 | import org.arend.psi.getChildrenOfType 8 | import org.arend.term.abs.Abstract 9 | 10 | class ArendWithBody(node: ASTNode) : ArendSourceNodeImpl(node), Abstract.FunctionClauses { 11 | val withKw: PsiElement 12 | get() = childOfTypeStrict(ArendElementTypes.WITH_KW) 13 | 14 | val lbrace: PsiElement? 15 | get() = findChildByType(ArendElementTypes.LBRACE) 16 | 17 | override fun getData() = this 18 | 19 | override fun getClauseList(): List = getChildrenOfType() 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/PsiConcreteReferable.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import org.arend.ext.error.ErrorReporter 4 | import org.arend.naming.reference.converter.ReferableConverter 5 | import org.arend.term.concrete.Concrete 6 | 7 | 8 | interface PsiConcreteReferable: PsiDefReferable { 9 | fun computeConcrete(referableConverter: ReferableConverter, errorReporter: ErrorReporter): Concrete.ResolvableDefinition 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/ext/TCDefinition.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.ext 2 | 3 | import org.arend.naming.reference.TCDefReferable 4 | 5 | interface TCDefinition : PsiConcreteReferable { 6 | override val tcReferable: TCDefReferable? 7 | } 8 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/listener/ArendDefinitionChangeListener.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.listener 2 | 3 | import org.arend.psi.ArendFile 4 | import org.arend.psi.ext.PsiConcreteReferable 5 | 6 | 7 | interface ArendDefinitionChangeListener { 8 | fun updateDefinition(def: PsiConcreteReferable, file: ArendFile, isExternalUpdate: Boolean) 9 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/stubs/StubInterfaces.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.stubs 2 | 3 | import org.arend.ext.reference.Precedence 4 | 5 | interface ArendNamedStub { 6 | val name: String? 7 | val precedence: Precedence? 8 | } 9 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/stubs/index/ArendDefinitionIndex.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.stubs.index 2 | 3 | import com.intellij.psi.stubs.StringStubIndexExtension 4 | import com.intellij.psi.stubs.StubIndexKey 5 | import org.arend.psi.ext.PsiReferable 6 | import org.arend.psi.stubs.ArendFileStub 7 | 8 | class ArendDefinitionIndex : StringStubIndexExtension() { 9 | 10 | override fun getVersion(): Int = ArendFileStub.Type.stubVersion 11 | 12 | override fun getKey(): StubIndexKey = KEY 13 | 14 | companion object { 15 | val KEY: StubIndexKey = 16 | StubIndexKey.createIndexKey(ArendDefinitionIndex::class.java.canonicalName) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/stubs/index/ArendFileIndex.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.stubs.index 2 | 3 | import com.intellij.psi.stubs.StringStubIndexExtension 4 | import com.intellij.psi.stubs.StubIndexKey 5 | import org.arend.psi.ArendFile 6 | import org.arend.psi.stubs.ArendFileStub 7 | 8 | class ArendFileIndex : StringStubIndexExtension() { 9 | 10 | override fun getVersion(): Int = ArendFileStub.Type.stubVersion 11 | 12 | override fun getKey(): StubIndexKey = KEY 13 | 14 | companion object { 15 | val KEY: StubIndexKey = 16 | StubIndexKey.createIndexKey(ArendFileIndex::class.java.canonicalName) 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/stubs/index/ArendGotoClassIndex.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.stubs.index 2 | 3 | import com.intellij.psi.stubs.StringStubIndexExtension 4 | import com.intellij.psi.stubs.StubIndexKey 5 | import org.arend.psi.ext.PsiReferable 6 | import org.arend.psi.stubs.ArendFileStub 7 | 8 | class ArendGotoClassIndex : StringStubIndexExtension() { 9 | 10 | override fun getVersion(): Int = ArendFileStub.Type.stubVersion 11 | 12 | override fun getKey(): StubIndexKey = KEY 13 | 14 | companion object { 15 | val KEY: StubIndexKey = 16 | StubIndexKey.createIndexKey(ArendGotoClassIndex::class.java.canonicalName) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/psi/stubs/index/ArendNamedElementIndex.kt: -------------------------------------------------------------------------------- 1 | package org.arend.psi.stubs.index 2 | 3 | import com.intellij.psi.stubs.StringStubIndexExtension 4 | import com.intellij.psi.stubs.StubIndexKey 5 | import org.arend.psi.ext.PsiReferable 6 | import org.arend.psi.stubs.ArendFileStub 7 | 8 | class ArendNamedElementIndex : StringStubIndexExtension() { 9 | 10 | override fun getVersion(): Int = ArendFileStub.Type.stubVersion 11 | 12 | override fun getKey(): StubIndexKey = KEY 13 | 14 | companion object { 15 | val KEY: StubIndexKey = 16 | StubIndexKey.createIndexKey(ArendNamedElementIndex::class.java.canonicalName) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/quickfix/ArendQuickFixesBase.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import com.intellij.psi.util.childrenOfType 4 | import org.arend.psi.ArendPsiFactory 5 | import org.arend.psi.descendantOfType 6 | import org.arend.psi.ext.ArendCaseArg 7 | import org.arend.psi.ext.ArendCaseExpr 8 | import org.arend.psi.ext.ArendReturnExpr 9 | 10 | internal fun updateReturnExpression(psiFactory: ArendPsiFactory, element: ArendCaseExpr): ArendReturnExpr? { 11 | if (element.descendantOfType() != null) { 12 | return null 13 | } 14 | var returnKeyword = psiFactory.createReturnKeyword() 15 | val returnExpr = psiFactory.createReturnExpr() 16 | 17 | val caseArg = element.childrenOfType().let { 18 | if (it.isEmpty()) return null 19 | it.last() 20 | } 21 | 22 | returnKeyword = element.addAfter(returnKeyword, caseArg) 23 | return element.addAfter(returnExpr, returnKeyword) as ArendReturnExpr 24 | } 25 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/quickfix/GoalFillingQuickFix.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import com.intellij.codeInsight.intention.IntentionAction 4 | import com.intellij.openapi.editor.Editor 5 | import com.intellij.openapi.project.Project 6 | import com.intellij.psi.PsiFile 7 | import org.arend.psi.ext.ArendGoal 8 | import org.arend.refactoring.replaceExprSmart 9 | import org.arend.util.ArendBundle 10 | 11 | class GoalFillingQuickFix(private val element: ArendGoal) : IntentionAction { 12 | override fun invoke(project: Project, editor: Editor, file: PsiFile?) { 13 | val expr = element.expr ?: return 14 | replaceExprSmart(editor.document, element, null, element.textRange, expr, null, expr.text) 15 | } 16 | 17 | override fun startInWriteAction() = true 18 | 19 | override fun getFamilyName() = text 20 | 21 | override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?) = element.isValid 22 | 23 | override fun getText() = ArendBundle.message("arend.expression.fillGoal") 24 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/quickfix/removers/RemoveArgumentQuickFix.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix.removers 2 | 3 | import com.intellij.codeInsight.intention.IntentionAction 4 | import com.intellij.openapi.editor.Editor 5 | import com.intellij.openapi.project.Project 6 | import com.intellij.psi.PsiFile 7 | import com.intellij.psi.SmartPsiElementPointer 8 | import org.arend.psi.deleteWithWhitespaces 9 | import org.arend.psi.ext.ArendArgument 10 | 11 | class RemoveArgumentQuickFix(private val message: String, private val argument: SmartPsiElementPointer) : IntentionAction { 12 | override fun startInWriteAction() = true 13 | 14 | override fun getText() = message 15 | 16 | override fun getFamilyName() = text 17 | 18 | override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?) = argument.element != null 19 | 20 | override fun invoke(project: Project, editor: Editor?, file: PsiFile?) { 21 | argument.element?.deleteWithWhitespaces() 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/quickfix/replacers/ReplaceSigmaFieldKindQuickFix.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix.replacers 2 | 3 | import com.intellij.codeInsight.intention.IntentionAction 4 | import com.intellij.openapi.editor.Editor 5 | import com.intellij.openapi.project.Project 6 | import com.intellij.psi.PsiElement 7 | import com.intellij.psi.PsiFile 8 | import com.intellij.psi.SmartPsiElementPointer 9 | import org.arend.util.ArendBundle 10 | 11 | class ReplaceSigmaFieldKindQuickFix(private val kwRef: SmartPsiElementPointer) : IntentionAction { 12 | override fun startInWriteAction(): Boolean = true 13 | 14 | override fun getFamilyName(): String = text 15 | 16 | override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?): Boolean = kwRef.element != null 17 | 18 | override fun getText(): String = ArendBundle.message("arend.replace.sigma.kind") 19 | 20 | override fun invoke(project: Project, editor: Editor?, file: PsiFile?) { 21 | kwRef.element?.delete() 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/refactoring/ArendRenameInputValidator.kt: -------------------------------------------------------------------------------- 1 | package org.arend.refactoring 2 | 3 | import com.intellij.patterns.ElementPattern 4 | import com.intellij.patterns.PlatformPatterns 5 | import com.intellij.psi.PsiElement 6 | import com.intellij.refactoring.rename.RenameInputValidator 7 | import com.intellij.util.ProcessingContext 8 | import org.arend.psi.ext.PsiReferable 9 | 10 | class ArendRenameInputValidator : RenameInputValidator { 11 | override fun getPattern(): ElementPattern = 12 | PlatformPatterns.psiElement(PsiReferable::class.java) 13 | 14 | override fun isInputValid(newName: String, element: PsiElement, context: ProcessingContext) = 15 | ArendNamesValidator.INSTANCE.isIdentifier(newName, null) 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/refactoring/changeSignature/ArendChangeSignatureDialogParameter.kt: -------------------------------------------------------------------------------- 1 | package org.arend.refactoring.changeSignature 2 | 3 | import com.intellij.psi.util.elementType 4 | import org.arend.naming.reference.ClassReferable 5 | import org.arend.naming.reference.TypedReferable 6 | import org.arend.psi.ArendElementTypes 7 | import org.arend.psi.descendantOfType 8 | import org.arend.psi.ext.ArendExpr 9 | import org.arend.resolving.util.ReferableExtractVisitor 10 | 11 | class ArendChangeSignatureDialogParameter(val item: ArendChangeSignatureDialogParameterTableModelItem): TypedReferable { 12 | override fun textRepresentation(): String = item.parameter.name 13 | 14 | override fun getTypeClassReference(): ClassReferable? { 15 | val type = item.typeCodeFragment.descendantOfType() 16 | return if (type != null && type.elementType != ArendElementTypes.EXPR) ReferableExtractVisitor().findClassReferable(type) else null 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/refactoring/changeSignature/ArendChangeSignatureDialogParameterTableModelItem.kt: -------------------------------------------------------------------------------- 1 | package org.arend.refactoring.changeSignature 2 | 3 | import com.intellij.refactoring.changeSignature.ParameterTableModelItemBase 4 | import org.arend.psi.ArendExpressionCodeFragment 5 | 6 | class ArendChangeSignatureDialogParameterTableModelItem(resultParameterInfo: ArendTextualParameter, 7 | typeCodeFragment: ArendExpressionCodeFragment): 8 | ParameterTableModelItemBase(resultParameterInfo, typeCodeFragment, null) { 9 | val associatedReferable = ArendChangeSignatureDialogParameter(this) 10 | 11 | override fun isEllipsisType(): Boolean = false 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/refactoring/changeSignature/DoubleStringBuilder.kt: -------------------------------------------------------------------------------- 1 | package org.arend.refactoring.changeSignature 2 | 3 | class DoubleStringBuilder { 4 | val defaultBuilder = StringBuilder() 5 | val alternativeBuilder = StringBuilder() 6 | 7 | fun append(text: String) { 8 | defaultBuilder.append(text) 9 | alternativeBuilder.append(text) 10 | } 11 | 12 | fun append(text: String, alternativeText: String) { 13 | defaultBuilder.append(text) 14 | alternativeBuilder.append(alternativeText) 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/refactoring/changeSignature/entries/NoArgumentsEntry.kt: -------------------------------------------------------------------------------- 1 | package org.arend.refactoring.changeSignature.entries 2 | 3 | import org.arend.psi.ext.ArendCompositeElement 4 | import org.arend.refactoring.changeSignature.* 5 | import org.arend.term.concrete.Concrete 6 | 7 | class NoArgumentsEntry(refExpr: Concrete.ReferenceExpression, refactoringContext: ChangeSignatureRefactoringContext, 8 | descriptor1: ChangeSignatureRefactoringDescriptor): 9 | UsageEntry(refactoringContext, refExpr.data as ArendCompositeElement, descriptor1, refExpr.referent) { 10 | private val contextName: String = getContextName(refactoringContext, refExpr) 11 | 12 | override fun getArguments(): List = emptyList() 13 | 14 | override fun getContextName(): String = contextName 15 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/refactoring/move/MoveRefactoringSignatureContext.kt: -------------------------------------------------------------------------------- 1 | package org.arend.refactoring.move 2 | 3 | import org.arend.psi.ext.ArendDefClass 4 | import org.arend.psi.ext.PsiLocatedReferable 5 | 6 | data class MoveRefactoringSignatureContext( 7 | val myThisVars: Map, 8 | val membersEnvelopingClasses: Map 9 | ) -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/refactoring/rename/ArendAliasNameSuggestionProvider.kt: -------------------------------------------------------------------------------- 1 | package org.arend.refactoring.rename 2 | 3 | import com.intellij.psi.PsiElement 4 | import com.intellij.psi.codeStyle.SuggestedNameInfo 5 | import com.intellij.refactoring.rename.NameSuggestionProvider 6 | import org.arend.psi.ext.ArendAlias 7 | 8 | class ArendAliasNameSuggestionProvider: NameSuggestionProvider { 9 | override fun getSuggestedNames(element: PsiElement, nameSuggestionContext: PsiElement?, result: MutableSet): SuggestedNameInfo? { 10 | if (nameSuggestionContext is ArendAlias) { 11 | val identifier = nameSuggestionContext.aliasIdentifier 12 | if (identifier != null) { 13 | result.clear() 14 | result.add(identifier.id.text) 15 | return SuggestedNameInfo.NULL_INFO 16 | } 17 | } 18 | return null 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/resolving/ArendReferableConverter.kt: -------------------------------------------------------------------------------- 1 | package org.arend.resolving 2 | 3 | import org.arend.naming.reference.* 4 | import org.arend.psi.ext.PsiLocatedReferable 5 | 6 | 7 | object ArendReferableConverter : BaseReferableConverter() { 8 | override fun toDataLocatedReferable(referable: LocatedReferable?): TCReferable? { 9 | return when (referable) { 10 | is PsiLocatedReferable -> referable.tcReferable 11 | is TCReferable -> referable 12 | else -> null 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/resolving/BaseReferableConverter.kt: -------------------------------------------------------------------------------- 1 | package org.arend.resolving 2 | 3 | import org.arend.naming.reference.Referable 4 | import org.arend.naming.reference.converter.ReferableConverter 5 | import org.arend.psi.ext.ArendDefMeta 6 | 7 | abstract class BaseReferableConverter : ReferableConverter { 8 | override fun convert(referable: Referable?): Referable? = (referable as? ArendDefMeta)?.metaRef ?: super.convert(referable) 9 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/resolving/IntellijTCReferable.kt: -------------------------------------------------------------------------------- 1 | package org.arend.resolving 2 | 3 | import org.arend.naming.reference.LocatedReferable 4 | import org.arend.naming.reference.TCReferable 5 | 6 | interface IntellijTCReferable : TCReferable { 7 | fun isEquivalent(ref: LocatedReferable): Boolean 8 | val isConsistent: Boolean 9 | var displayName: String? 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/scratch/ArendScratchCompilingExecutor.kt: -------------------------------------------------------------------------------- 1 | package org.arend.scratch 2 | 3 | import org.jetbrains.kotlin.idea.scratch.ScratchExecutor 4 | import org.jetbrains.kotlin.idea.scratch.ScratchFile 5 | 6 | class ArendScratchCompilingExecutor(file: ScratchFile) : ScratchExecutor(file) { 7 | override fun execute() { 8 | // TODO("Not yet implemented") 9 | } 10 | 11 | override fun stop() { 12 | // TODO("Not yet implemented") 13 | } 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/scratch/ArendScratchFileLanguageProvider.kt: -------------------------------------------------------------------------------- 1 | package org.arend.scratch 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.intellij.openapi.vfs.VirtualFile 5 | import org.jetbrains.kotlin.idea.scratch.ScratchExecutor 6 | import org.jetbrains.kotlin.idea.scratch.ScratchFile 7 | import org.jetbrains.kotlin.idea.scratch.ScratchFileLanguageProvider 8 | import org.jetbrains.kotlin.idea.scratch.SequentialScratchExecutor 9 | 10 | class ArendScratchFileLanguageProvider : ScratchFileLanguageProvider() { 11 | 12 | override fun createFile(project: Project, file: VirtualFile) = ArendScratchFile(project, file) 13 | 14 | override fun createReplExecutor(file: ScratchFile): SequentialScratchExecutor = ArendScratchReplExecutor(file) 15 | 16 | override fun createCompilingExecutor(file: ScratchFile): ScratchExecutor = ArendScratchCompilingExecutor(file) 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/scratch/ArendScratchModuleService.kt: -------------------------------------------------------------------------------- 1 | package org.arend.scratch 2 | 3 | import com.intellij.openapi.components.Service 4 | import com.intellij.openapi.module.Module 5 | import org.arend.psi.ArendFile 6 | 7 | @Service(Service.Level.PROJECT) 8 | class ArendScratchModuleService { 9 | private val scratchFilesToModules = mutableMapOf() 10 | 11 | fun updateFileModule(file: ArendFile, module: Module?) { 12 | scratchFilesToModules[file] = module 13 | } 14 | 15 | fun getModule(file: ArendFile) = scratchFilesToModules[file] 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/scratch/ArendScratchReplExecutor.kt: -------------------------------------------------------------------------------- 1 | package org.arend.scratch 2 | 3 | import org.jetbrains.kotlin.idea.scratch.ScratchExpression 4 | import org.jetbrains.kotlin.idea.scratch.ScratchFile 5 | import org.jetbrains.kotlin.idea.scratch.SequentialScratchExecutor 6 | 7 | class ArendScratchReplExecutor(file: ScratchFile) : SequentialScratchExecutor(file) { 8 | override fun executeStatement(expression: ScratchExpression) { 9 | // TODO("Not yet implemented") 10 | } 11 | 12 | override fun needProcessToStart(): Boolean { 13 | // TODO("Not yet implemented") 14 | return false 15 | } 16 | 17 | override fun startExecution() { 18 | // TODO("Not yet implemented") 19 | } 20 | 21 | override fun stopExecution(callback: (() -> Unit)?) { 22 | // TODO("Not yet implemented") 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/scratch/Utils.kt: -------------------------------------------------------------------------------- 1 | package org.arend.scratch 2 | 3 | import com.intellij.ide.scratch.ScratchFileService 4 | import com.intellij.ide.scratch.ScratchRootType 5 | import com.intellij.openapi.vfs.VirtualFile 6 | import com.intellij.psi.PsiFile 7 | 8 | const val SCRATCH_SUFFIX = "ars" 9 | 10 | val VirtualFile?.isArendScratch: Boolean 11 | get() = SCRATCH_SUFFIX == this?.extension && 12 | ScratchFileService.getInstance().getRootType(this) is ScratchRootType 13 | 14 | val PsiFile?.isArendScratch: Boolean 15 | get() { 16 | return if (this?.virtualFile != null) { 17 | virtualFile.isArendScratch 18 | } else { 19 | this?.name?.endsWith(".$SCRATCH_SUFFIX") == true 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/scratch/actions/ArendClearScratchAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.scratch.actions 2 | 3 | import com.intellij.icons.AllIcons 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import org.jetbrains.kotlin.idea.KotlinJvmBundle 6 | 7 | class ArendClearScratchAction : ArendScratchAction( 8 | KotlinJvmBundle.message("scratch.clear.button"), 9 | AllIcons.Actions.GC 10 | ) { 11 | override fun actionPerformed(e: AnActionEvent) { 12 | val scratchEditor = e.currentScratchEditor ?: return 13 | 14 | scratchEditor.clearOutputHandlers() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/scratch/actions/ArendStopScratchAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.scratch.actions 2 | 3 | import com.intellij.icons.AllIcons 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import org.jetbrains.kotlin.idea.KotlinJvmBundle 6 | import org.jetbrains.kotlin.idea.scratch.actions.ScratchCompilationSupport 7 | 8 | class ArendStopScratchAction : ArendScratchAction( 9 | KotlinJvmBundle.message("scratch.stop.button"), 10 | AllIcons.Actions.Suspend 11 | ) { 12 | 13 | override fun actionPerformed(e: AnActionEvent) { 14 | ScratchCompilationSupport.forceStop() 15 | } 16 | 17 | override fun update(e: AnActionEvent) { 18 | super.update(e) 19 | 20 | val scratchFile = e.currentScratchFile ?: return 21 | 22 | e.presentation.isEnabledAndVisible = ScratchCompilationSupport.isInProgress(scratchFile) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/search/proof/ArendProofSearchAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.search.proof 2 | 3 | import com.intellij.openapi.actionSystem.ActionUpdateThread 4 | import com.intellij.openapi.actionSystem.AnAction 5 | import com.intellij.openapi.actionSystem.AnActionEvent 6 | import com.intellij.openapi.actionSystem.LangDataKeys 7 | import com.intellij.openapi.components.service 8 | import org.arend.ArendIcons 9 | import org.arend.ArendLanguage 10 | 11 | class ArendProofSearchAction : AnAction(ArendIcons.AREND) { 12 | override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT 13 | 14 | override fun actionPerformed(e: AnActionEvent) { 15 | e.project?.service()?.show(e) 16 | } 17 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/search/proof/ShowHelpAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.search.proof 2 | 3 | import com.intellij.icons.AllIcons 4 | import com.intellij.ide.BrowserUtil 5 | import com.intellij.openapi.actionSystem.ActionUpdateThread 6 | import com.intellij.openapi.actionSystem.AnActionEvent 7 | import com.intellij.openapi.project.DumbAwareAction 8 | import org.arend.util.ArendBundle 9 | 10 | class ShowHelpAction(private val ui: ProofSearchUI) : DumbAwareAction( 11 | ArendBundle.getLazyMessage("arend.proof.search.show.help"), 12 | ArendBundle.getLazyMessage("arend.proof.search.show.help.description"), AllIcons.General.ContextHelp 13 | ) { 14 | 15 | override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT 16 | 17 | override fun actionPerformed(e: AnActionEvent) { 18 | ui.close() 19 | BrowserUtil.browse("https://arend-lang.github.io/documentation/plugin-manual/navigating#proof-search") 20 | } 21 | 22 | override fun update(e: AnActionEvent) { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/settings/ArendProjectStatistics.kt: -------------------------------------------------------------------------------- 1 | package org.arend.settings 2 | 3 | import com.intellij.openapi.components.* 4 | 5 | @Service(Service.Level.PROJECT) 6 | @State(name = "ArendStatistics", storages = [Storage(StoragePathMacros.WORKSPACE_FILE)]) 7 | class ArendProjectStatistics : SimplePersistentStateComponent(ArendProjectStatisticsState()) 8 | 9 | class ArendProjectStatisticsState : BaseState() { 10 | var implementFieldsStatistics by map>() 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/structure/ArendPsiStructureViewFactory.kt: -------------------------------------------------------------------------------- 1 | package org.arend.structure 2 | 3 | import com.intellij.ide.structureView.StructureViewBuilder 4 | import com.intellij.ide.structureView.StructureViewModel 5 | import com.intellij.ide.structureView.TreeBasedStructureViewBuilder 6 | import com.intellij.lang.PsiStructureViewFactory 7 | import com.intellij.openapi.editor.Editor 8 | import com.intellij.psi.PsiFile 9 | import org.arend.psi.ArendFile 10 | 11 | class ArendPsiStructureViewFactory : PsiStructureViewFactory { 12 | override fun getStructureViewBuilder(psiFile: PsiFile): StructureViewBuilder? { 13 | if (psiFile !is ArendFile) return null 14 | return object : TreeBasedStructureViewBuilder() { 15 | override fun createStructureViewModel(editor: Editor?): StructureViewModel = 16 | ArendStructureViewModel(editor, psiFile) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/structure/ArendStructureViewBuilderProvider.kt: -------------------------------------------------------------------------------- 1 | package org.arend.structure 2 | 3 | import com.intellij.ide.structureView.StructureViewBuilder 4 | import com.intellij.ide.structureView.StructureViewBuilderProvider 5 | import com.intellij.openapi.fileTypes.FileType 6 | import com.intellij.openapi.project.Project 7 | import com.intellij.openapi.vfs.VirtualFile 8 | import com.intellij.psi.PsiManager 9 | import org.arend.psi.ArendFile 10 | 11 | class ArendStructureViewBuilderProvider : StructureViewBuilderProvider { 12 | override fun getStructureViewBuilder(fileType: FileType, file: VirtualFile, project: Project): StructureViewBuilder? { 13 | val arendFile = PsiManager.getInstance(project).findFile(file) as? ArendFile ?: return null 14 | return ArendPsiStructureViewFactory().getStructureViewBuilder(arendFile) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/SimpleToolWindowService.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.intellij.openapi.wm.RegisterToolWindowTask 5 | import com.intellij.openapi.wm.ToolWindow 6 | import com.intellij.openapi.wm.ToolWindowAnchor 7 | import com.intellij.openapi.wm.ToolWindowManager 8 | import org.arend.toolWindow.repl.ArendReplService 9 | 10 | abstract class SimpleToolWindowService(@JvmField protected val project: Project) { 11 | @JvmField protected var myToolWindow: ToolWindow? = null 12 | 13 | abstract val title: String 14 | 15 | protected fun registerToolWindow(manager: ToolWindowManager) = 16 | manager.registerToolWindow(RegisterToolWindowTask(title, ToolWindowAnchor.BOTTOM, canWorkInDumbMode = false)) 17 | 18 | protected fun activate(toolWindow: ToolWindow, manager: ToolWindowManager) = 19 | toolWindow.activate { 20 | manager.focusManager.requestFocusInProject(toolWindow.component, project) 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/errors/ArendClearGoalAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.errors 2 | 3 | import com.intellij.openapi.actionSystem.AnAction 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import com.intellij.openapi.components.service 6 | import org.arend.ArendIcons 7 | import org.arend.util.ArendBundle 8 | 9 | class ArendClearGoalAction : AnAction( 10 | ArendBundle.message("arend.clear.goal.action.name"), 11 | ArendBundle.message("arend.clear.goal.action.description"), 12 | ArendIcons.CLEAR 13 | ) { 14 | override fun actionPerformed(e: AnActionEvent) { 15 | e.project?.service()?.clearGoalEditor() 16 | } 17 | 18 | companion object { 19 | const val ID = "Arend.ClearGoal" 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/errors/ArendMessagesFactory.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.errors 2 | 3 | import com.intellij.openapi.project.DumbAware 4 | import com.intellij.openapi.project.Project 5 | import com.intellij.openapi.wm.ToolWindow 6 | import com.intellij.openapi.wm.ToolWindowFactory 7 | 8 | 9 | class ArendMessagesFactory : ToolWindowFactory, DumbAware { 10 | override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) { 11 | project.getService(ArendMessagesService::class.java).initView(toolWindow) 12 | } 13 | 14 | companion object { 15 | const val TOOL_WINDOW_ID = "Arend Messages" 16 | } 17 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/errors/ArendPrintOptionsActionGroup.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.errors 2 | 3 | import com.intellij.openapi.actionSystem.DefaultActionGroup 4 | import com.intellij.openapi.project.DumbAware 5 | import com.intellij.openapi.project.Project 6 | import org.arend.ArendIcons 7 | import org.arend.ext.prettyprinting.PrettyPrinterFlag 8 | 9 | class ArendPrintOptionsActionGroup( 10 | project: Project, 11 | kind: PrintOptionKind, 12 | callback: Runnable? = null, 13 | isEnabled: Boolean = true 14 | ) : 15 | DefaultActionGroup("${kind.kindName}'s pretty printer options", true), DumbAware { 16 | private var actionMap = HashMap() 17 | 18 | init { 19 | templatePresentation.icon = ArendIcons.SHOW 20 | if (isEnabled) { 21 | for (type in PrettyPrinterFlag.values()) { 22 | val action = ArendPrintOptionsFilterAction(project, kind, type, callback) 23 | add(action) 24 | actionMap[type] = action 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/errors/ArendShowErrorsPanelAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.errors 2 | 3 | import com.intellij.icons.AllIcons 4 | import com.intellij.openapi.actionSystem.ActionUpdateThread 5 | import com.intellij.openapi.actionSystem.AnActionEvent 6 | import com.intellij.openapi.actionSystem.ToggleAction 7 | import com.intellij.openapi.components.service 8 | import org.arend.util.ArendBundle 9 | 10 | class ArendShowErrorsPanelAction : ToggleAction( 11 | ArendBundle.message("arend.show.errors.panel.action.name"), 12 | ArendBundle.message("arend.show.errors.panel.action.description"), 13 | AllIcons.Actions.PreviewDetails 14 | ) { 15 | override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT 16 | 17 | override fun isSelected(e: AnActionEvent): Boolean = 18 | e.project?.service()?.isShowErrorsPanel?.get() ?: true 19 | 20 | override fun setSelected(e: AnActionEvent, state: Boolean) { 21 | e.project?.service()?.isShowErrorsPanel?.set(state) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/errors/ArendShowImplicitGoalsAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.errors 2 | 3 | import com.intellij.openapi.actionSystem.ActionUpdateThread 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import com.intellij.openapi.actionSystem.ToggleAction 6 | import com.intellij.openapi.components.service 7 | import org.arend.ArendIcons 8 | import org.arend.util.ArendBundle 9 | 10 | class ArendShowImplicitGoalsAction : ToggleAction( 11 | ArendBundle.message("arend.show.implicit.goals.action.name"), 12 | ArendBundle.message("arend.show.implicit.goals.action.description"), 13 | ArendIcons.IMPLICIT_GOAL 14 | ) { 15 | 16 | override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT 17 | 18 | override fun isSelected(e: AnActionEvent): Boolean = 19 | e.project?.service()?.isShowImplicitGoals?.get() ?: false 20 | 21 | override fun setSelected(e: AnActionEvent, state: Boolean) { 22 | e.project?.service()?.isShowImplicitGoals?.set(state) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/errors/tree/ArendErrorTreeAutoScrollToSource.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.errors.tree 2 | 3 | import com.intellij.openapi.components.service 4 | import com.intellij.openapi.project.Project 5 | import com.intellij.ui.AutoScrollToSourceHandler 6 | import org.arend.settings.ArendProjectSettings 7 | import java.awt.Component 8 | 9 | 10 | class ArendErrorTreeAutoScrollToSource(private val project: Project, private val tree: ArendErrorTree) : AutoScrollToSourceHandler() { 11 | init { 12 | install(tree) 13 | } 14 | 15 | override fun isAutoScrollMode() = project.service().data.autoScrollToSource 16 | 17 | override fun setAutoScrollMode(state: Boolean) { 18 | project.service().data.autoScrollToSource = state 19 | } 20 | 21 | override fun scrollToSource(component: Component) { 22 | tree.navigate(false) 23 | } 24 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/errors/tree/ArendErrorTreeListener.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.errors.tree 2 | 3 | import org.arend.typechecking.error.ArendError 4 | 5 | interface ArendErrorTreeListener { 6 | fun errorAdded(arendError: ArendError) {} 7 | fun errorRemoved(arendError: ArendError) {} 8 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/repl/ArendReplCompletion.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.repl 2 | 3 | import org.arend.repl.CommandHandler 4 | import org.arend.repl.action.NormalizeCommand 5 | import org.arend.repl.action.PrettyPrintFlagCommand 6 | 7 | fun getReplCompletion(commandName: String): Array = 8 | when (CommandHandler.INSTANCE.commandMap[commandName]) { 9 | is PrettyPrintFlagCommand -> PrettyPrintFlagCommand.AVAILABLE_OPTIONS.toTypedArray() 10 | is NormalizeCommand -> NormalizeCommand.AVAILABLE_OPTIONS.map { it }.toTypedArray() 11 | is CommandHandler.HelpCommand -> CommandHandler.INSTANCE.commandMap.keys.toTypedArray() 12 | else -> emptyArray() 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/repl/ArendShowReplAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.repl 2 | 3 | import com.intellij.openapi.actionSystem.AnAction 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import com.intellij.openapi.components.service 6 | import org.arend.ArendIcons 7 | 8 | class ArendShowReplAction : AnAction(ArendIcons.REPL) { 9 | override fun actionPerformed(e: AnActionEvent) { 10 | e.project?.service()?.show() 11 | } 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/repl/action/IntellijReplCommand.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.repl.action 2 | 3 | import org.arend.repl.QuitReplException 4 | import org.arend.repl.Repl 5 | import org.arend.repl.action.ReplCommand 6 | import org.arend.toolWindow.repl.IntellijRepl 7 | import java.util.function.Supplier 8 | 9 | interface IntellijReplCommand : ReplCommand { 10 | @Throws(QuitReplException::class) 11 | override operator fun invoke(line: String, api: Repl, scanner: Supplier) { 12 | assert(api is IntellijRepl) 13 | invoke(line, api as IntellijRepl, scanner) 14 | } 15 | 16 | override fun help(api: Repl): String { 17 | assert(api is IntellijRepl) 18 | return help(api as IntellijRepl) 19 | } 20 | 21 | fun help(api: IntellijRepl): String = super.help(api) 22 | 23 | /** 24 | * @param line the command prefix is already removed. 25 | * @param api repl context 26 | * @param scanner user input reader 27 | */ 28 | @Throws(QuitReplException::class) 29 | operator fun invoke(line: String, api: IntellijRepl, scanner: Supplier) 30 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/repl/action/SetPromptCommand.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.repl.action 2 | 3 | import org.arend.toolWindow.repl.IntellijRepl 4 | import java.util.function.Supplier 5 | 6 | object SetPromptCommand : IntellijReplCommand { 7 | override fun description() = "Change the REPL prompt" 8 | override fun help(api: IntellijRepl) = "Change the REPL prompt (current prompt: `${api.handler.consoleView.prompt}`)" 9 | override fun invoke(line: String, api: IntellijRepl, scanner: Supplier) { 10 | api.handler.consoleView.prompt = line.removeSurrounding("\"") 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/toolWindow/repl/action/ShowContextCommandIntellij.kt: -------------------------------------------------------------------------------- 1 | package org.arend.toolWindow.repl.action 2 | 3 | import com.intellij.psi.PsiElement 4 | import org.arend.repl.action.ShowContextCommand 5 | import org.arend.toolWindow.repl.IntellijRepl 6 | import java.util.function.Supplier 7 | 8 | object ShowContextCommandIntellij: IntellijReplCommand { 9 | override fun invoke(line: String, api: IntellijRepl, scanner: Supplier) { 10 | val builder = StringBuilder() 11 | for (statement in api.statements) { 12 | builder.append((statement as? PsiElement)?.text) 13 | builder.append("\n") 14 | } 15 | api.print(builder.toString()) 16 | } 17 | 18 | override fun description(): String = ShowContextCommand.INSTANCE.description() 19 | 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/typechecking/ModificationCancellationIndicator.kt: -------------------------------------------------------------------------------- 1 | package org.arend.typechecking 2 | 3 | import com.intellij.openapi.util.ModificationTracker 4 | import org.arend.typechecking.computation.CancellationIndicator 5 | 6 | class ModificationCancellationIndicator(private val tracker: ModificationTracker, private var modCount: Long = tracker.modificationCount) : CancellationIndicator { 7 | override fun isCanceled() = tracker.modificationCount > modCount 8 | 9 | override fun cancel() { 10 | modCount-- 11 | } 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/typechecking/ProgressCancellationIndicator.kt: -------------------------------------------------------------------------------- 1 | package org.arend.typechecking 2 | 3 | import com.intellij.openapi.progress.ProgressIndicator 4 | import org.arend.typechecking.computation.CancellationIndicator 5 | 6 | 7 | class ProgressCancellationIndicator(val progress: ProgressIndicator) : CancellationIndicator { 8 | override fun isCanceled() = progress.isCanceled 9 | 10 | override fun cancel() { 11 | progress.cancel() 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/typechecking/error/ParserError.kt: -------------------------------------------------------------------------------- 1 | package org.arend.typechecking.error 2 | 3 | import com.intellij.psi.PsiErrorElement 4 | import com.intellij.psi.SmartPsiElementPointer 5 | import org.arend.ext.error.GeneralError 6 | import org.arend.ext.reference.ArendRef 7 | import org.arend.naming.reference.GlobalReferable 8 | import java.util.function.BiConsumer 9 | 10 | 11 | class ParserError(private val psiElement: SmartPsiElementPointer, private val referable: GlobalReferable, errorDescription: String) 12 | : GeneralError(Level.ERROR, errorDescription) { 13 | 14 | override fun forAffectedDefinitions(consumer: BiConsumer) { 15 | consumer.accept(referable, this) 16 | } 17 | 18 | override fun getCause() = PsiSourceInfo(psiElement) 19 | 20 | override fun getStage() = Stage.PARSER 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/typechecking/execution/TypeCheckCommand.kt: -------------------------------------------------------------------------------- 1 | package org.arend.typechecking.execution 2 | 3 | data class TypeCheckCommand( 4 | val library: String = "", 5 | val isTest: Boolean = false, 6 | val modulePath: String = "", 7 | val definitionFullName: String = "" 8 | ) 9 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/typechecking/execution/TypeCheckRunner.kt: -------------------------------------------------------------------------------- 1 | package org.arend.typechecking.execution 2 | 3 | import com.intellij.execution.configurations.RunProfile 4 | import com.intellij.execution.configurations.RunnerSettings 5 | import com.intellij.execution.executors.DefaultRunExecutor 6 | import com.intellij.execution.runners.GenericProgramRunner 7 | import org.arend.typechecking.execution.configurations.TypeCheckConfiguration 8 | 9 | class TypeCheckRunner : GenericProgramRunner() { 10 | 11 | override fun canRun(executorId: String, profile: RunProfile): Boolean = 12 | executorId == DefaultRunExecutor.EXECUTOR_ID && profile is TypeCheckConfiguration 13 | 14 | override fun getRunnerId(): String = "TypeCheckRunner" 15 | } 16 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/typechecking/execution/configurations/ArendRunConfigurationFactory.kt: -------------------------------------------------------------------------------- 1 | package org.arend.typechecking.execution.configurations 2 | 3 | import com.intellij.compiler.options.CompileStepBeforeRun 4 | import com.intellij.execution.BeforeRunTask 5 | import com.intellij.execution.configurations.ConfigurationFactory 6 | import com.intellij.execution.configurations.ConfigurationType 7 | import com.intellij.openapi.project.Project 8 | import com.intellij.openapi.util.Key 9 | 10 | class ArendRunConfigurationFactory(configurationType: ConfigurationType) : ConfigurationFactory(configurationType) { 11 | override fun createTemplateConfiguration(project: Project) = TypeCheckConfiguration(project, "Arend", this) 12 | 13 | override fun configureBeforeRunTaskDefaults(providerID: Key>>, task: BeforeRunTask>) { 14 | if (providerID == CompileStepBeforeRun.ID) { 15 | task.isEnabled = false 16 | } 17 | } 18 | 19 | override fun getId() = "Arend Typecheck" 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/typechecking/execution/configurations/TypeCheckRunConfigurationModule.kt: -------------------------------------------------------------------------------- 1 | package org.arend.typechecking.execution.configurations 2 | 3 | import com.intellij.execution.configurations.RunConfigurationModule 4 | import com.intellij.openapi.project.Project 5 | 6 | class TypeCheckRunConfigurationModule(project: Project) : RunConfigurationModule(project) 7 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/typechecking/execution/configurations/TypecheckRunConfigurationType.kt: -------------------------------------------------------------------------------- 1 | package org.arend.typechecking.execution.configurations 2 | 3 | import com.intellij.execution.configurations.ConfigurationTypeBase 4 | import org.arend.ArendIcons 5 | 6 | class TypecheckRunConfigurationType : ConfigurationTypeBase("TypecheckRunConfiguration", "Arend Typecheck", "Arend typechecking run configuration", ArendIcons.RUN_CONFIGURATION) { 7 | init { 8 | addFactory(ArendRunConfigurationFactory(this)) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/ArendDialog.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.intellij.openapi.ui.DialogWrapper 5 | import com.intellij.ui.ScrollPaneFactory 6 | import javax.swing.JComponent 7 | import javax.swing.JLabel 8 | 9 | class ArendDialog(project: Project, title: String?, private val description: String?, private val component: JComponent?, private val focused: JComponent? = component) : DialogWrapper(project, true) { 10 | init { 11 | if (title != null) { 12 | setTitle(title) 13 | } 14 | init() 15 | } 16 | 17 | override fun createNorthPanel() = description?.let { JLabel(it) } 18 | 19 | override fun createCenterPanel() = component?.let { ScrollPaneFactory.createScrollPane(it, true) } 20 | 21 | override fun getPreferredFocusedComponent() = focused 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/IconButton.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui 2 | 3 | import com.intellij.openapi.ui.FixedSizeButton 4 | import javax.swing.Icon 5 | import kotlin.math.max 6 | 7 | 8 | class IconButton(icon: Icon) : FixedSizeButton(max(icon.iconWidth, icon.iconHeight) * 2) { 9 | init { 10 | this.icon = icon 11 | isFocusable = true 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/SimpleListModel.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui 2 | 3 | import com.intellij.ui.CollectionListModel 4 | 5 | 6 | class SimpleListModel : CollectionListModel() { 7 | var list: List 8 | get() = internalList 9 | set(value) { 10 | removeAll() 11 | addAll(0, value) 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/cellRenderer/ToolTipListCellRenderer.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui.cellRenderer 2 | 3 | import java.awt.Component 4 | import javax.swing.DefaultListCellRenderer 5 | import javax.swing.JList 6 | 7 | 8 | class ToolTipListCellRenderer(private val toolTips: List) : DefaultListCellRenderer() { 9 | override fun getListCellRendererComponent(list: JList<*>, value: Any?, index: Int, isSelected: Boolean, cellHasFocus: Boolean): Component { 10 | val comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus) 11 | if (index >= 0 && index < toolTips.size) { 12 | list.toolTipText = toolTips[index] 13 | } 14 | return comp 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/console/ArendClearConsoleAction.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui.console 2 | 3 | import com.intellij.openapi.actionSystem.AnAction 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import com.intellij.openapi.actionSystem.CustomShortcutSet 6 | import com.intellij.openapi.components.service 7 | import com.intellij.openapi.project.Project 8 | import org.arend.ArendIcons 9 | import java.awt.event.InputEvent 10 | import java.awt.event.KeyEvent 11 | import javax.swing.JComponent 12 | import javax.swing.KeyStroke 13 | 14 | class ArendClearConsoleAction(private val project: Project, console: JComponent) : AnAction("Clear console", "Clear the contents of the Arend Console", ArendIcons.CLEAR) { 15 | init { 16 | registerCustomShortcutSet(CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK)), console) 17 | } 18 | 19 | override fun actionPerformed(e: AnActionEvent) { 20 | project.service().clearText() 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/console/ArendConsoleViewEditor.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui.console 2 | 3 | import com.intellij.openapi.components.service 4 | import com.intellij.openapi.project.Project 5 | import org.arend.injection.InjectedArendEditor 6 | import org.arend.toolWindow.errors.ArendPrintOptionsActionGroup 7 | import org.arend.toolWindow.errors.PrintOptionKind 8 | 9 | class ArendConsoleViewEditor(project: Project) : InjectedArendEditor(project, ArendConsoleView.CONSOLE_ID, null) { 10 | override val printOptionKind: PrintOptionKind = PrintOptionKind.CONSOLE_PRINT_OPTIONS 11 | 12 | init { 13 | if (editor != null) { 14 | actionGroup.add(ArendClearConsoleAction(project, editor.contentComponent)) 15 | actionGroup.add(ArendPrintOptionsActionGroup(project, PrintOptionKind.CONSOLE_PRINT_OPTIONS, { 16 | project.service().updateText() 17 | })) 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/impl/query/CheckBoxQuery.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui.impl.query 2 | 3 | import com.intellij.ui.components.JBCheckBox 4 | import org.arend.ext.ui.ArendQuery 5 | 6 | class CheckBoxQuery(text: String?, selected: Boolean) : ArendQuery { 7 | val checkBox = JBCheckBox(text, selected) 8 | 9 | override fun getResult() = checkBox.isSelected 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/impl/query/ComboBoxQuery.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui.impl.query 2 | 3 | import com.intellij.openapi.ui.ComboBox 4 | import org.arend.ext.ui.ArendQuery 5 | 6 | class ComboBoxQuery(list: List) : ArendQuery { 7 | val comboBox = ComboBox(Array(list.size) { list[it] }) 8 | 9 | @Suppress("UNCHECKED_CAST") 10 | override fun getResult() = comboBox.selectedItem as? T 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/impl/query/SpinnerQuery.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui.impl.query 2 | 3 | import com.intellij.ui.JBIntSpinner 4 | import org.arend.ext.ui.ArendQuery 5 | 6 | class SpinnerQuery(defaultValue: Int) : ArendQuery { 7 | val spinner = JBIntSpinner(defaultValue, Int.MIN_VALUE, Int.MAX_VALUE) 8 | 9 | override fun getResult() = spinner.number 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/impl/query/TextFieldQuery.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui.impl.query 2 | 3 | import com.intellij.ui.components.JBTextField 4 | import org.arend.ext.ui.ArendQuery 5 | 6 | class TextFieldQuery(text: String?) : ArendQuery { 7 | val textField = JBTextField(text) 8 | 9 | override fun getResult(): String = textField.text 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/impl/session/ComponentSessionItem.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui.impl.session 2 | 3 | import javax.swing.JComponent 4 | 5 | interface ComponentSessionItem { 6 | val component: JComponent 7 | val focused: JComponent? 8 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/ui/impl/session/LabeledComponent.kt: -------------------------------------------------------------------------------- 1 | package org.arend.ui.impl.session 2 | 3 | import java.awt.BorderLayout 4 | import javax.swing.JComponent 5 | import javax.swing.JLabel 6 | import javax.swing.JPanel 7 | 8 | class LabeledComponent(message: String?, override val focused: JComponent) : ComponentSessionItem { 9 | override val component = if (message == null) focused else { 10 | val label = JLabel(message) 11 | label.labelFor = focused 12 | 13 | val panel = JPanel(BorderLayout()) 14 | panel.add(focused) 15 | panel.add(label, BorderLayout.NORTH) 16 | panel 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/util/ArendBundle.kt: -------------------------------------------------------------------------------- 1 | package org.arend.util 2 | 3 | import com.intellij.DynamicBundle 4 | import org.jetbrains.annotations.NonNls 5 | import org.jetbrains.annotations.PropertyKey 6 | 7 | @NonNls 8 | private const val BUNDLE = "messages.ArendBundle" 9 | 10 | object ArendBundle : DynamicBundle(BUNDLE) { 11 | @JvmStatic 12 | fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params) 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/util/ExpressionUtils.kt: -------------------------------------------------------------------------------- 1 | package org.arend.util 2 | 3 | import org.arend.core.context.param.DependentLink 4 | import org.arend.core.context.param.EmptyDependentLink 5 | import org.arend.core.expr.PiExpression 6 | 7 | fun PiExpression.allParameters(): Sequence = generateSequence(this) { it.codomain as? PiExpression } 8 | 9 | fun DependentLink.allBindings(): Sequence = generateSequence(this) { it.next.takeIf { it !is EmptyDependentLink } } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/yaml/codeInsight/YAMLHighlightingAnnotator.kt: -------------------------------------------------------------------------------- 1 | package org.arend.yaml.codeInsight 2 | 3 | import com.intellij.lang.annotation.AnnotationHolder 4 | import com.intellij.lang.annotation.Annotator 5 | import com.intellij.lang.annotation.HighlightSeverity 6 | import com.intellij.psi.PsiElement 7 | import com.intellij.psi.impl.source.tree.LeafPsiElement 8 | import org.arend.yaml.KEYS 9 | import org.arend.yaml.isYAMLConfig 10 | import org.jetbrains.yaml.YAMLTokenTypes 11 | 12 | 13 | class YAMLHighlightingAnnotator : Annotator { 14 | override fun annotate(element: PsiElement, holder: AnnotationHolder) { 15 | if (!holder.currentAnnotationSession.file.isYAMLConfig) { 16 | return 17 | } 18 | 19 | if (element is LeafPsiElement && element.node.elementType == YAMLTokenTypes.SCALAR_KEY) { 20 | val text = element.text 21 | if (!KEYS.contains(text)) { 22 | holder.newAnnotation(HighlightSeverity.ERROR, "Unknown key: $text") 23 | .range(element as PsiElement) 24 | .create() 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/yaml/schema/ArendYamlSchemaEnabler.kt: -------------------------------------------------------------------------------- 1 | package org.arend.yaml.schema 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.intellij.openapi.vfs.VirtualFile 5 | import com.jetbrains.jsonSchema.extension.JsonSchemaEnabler 6 | import org.arend.util.FileUtils 7 | 8 | class ArendYamlSchemaEnabler : JsonSchemaEnabler { 9 | override fun isEnabledForFile(file: VirtualFile, project: Project?) = 10 | FileUtils.LIBRARY_CONFIG_FILE == file.name 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/arend/yaml/schema/ArendYamlSchemaProviderFactory.kt: -------------------------------------------------------------------------------- 1 | package org.arend.yaml.schema 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.jetbrains.jsonSchema.extension.JsonSchemaProviderFactory 5 | 6 | class ArendYamlSchemaProviderFactory : JsonSchemaProviderFactory { 7 | override fun getProviders(project: Project) = 8 | listOf(ArendYamlSchemaProvider(project)) 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/plugin-json.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/fileTemplates/internal/Arend File.ard.ft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JetBrains/intellij-arend/023f903ab1a6b9c55d7b7fc1e60e21be2e24597c/src/main/resources/fileTemplates/internal/Arend File.ard.ft -------------------------------------------------------------------------------- /src/main/resources/fileTemplates/internal/Arend File.ard.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Empty Arend file. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/icons/checkmark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/icons/dataStructure.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/icons/goal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/icons/goal_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/icons/moveLeft.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/icons/moveLeft_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/icons/moveRight.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/icons/moveRight_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/icons/showFieldImpl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JetBrains/intellij-arend/023f903ab1a6b9c55d7b7fc1e60e21be2e24597c/src/main/resources/icons/showFieldImpl.png -------------------------------------------------------------------------------- /src/main/resources/icons/showFieldImpl.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/icons/showFieldImpl_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/icons/showNonImpl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JetBrains/intellij-arend/023f903ab1a6b9c55d7b7fc1e60e21be2e24597c/src/main/resources/icons/showNonImpl.png -------------------------------------------------------------------------------- /src/main/resources/icons/showNonImpl.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/icons/showNonImpl_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/icons/toolWindowMessages.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/toolWindowMessages_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/turnstile.svg: -------------------------------------------------------------------------------- 1 | 2 | Created with Fabric.js 4.6.0 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/ArendUnusedImport.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Reports redundant \import and \open statements. 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/RedundantParameter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Reports redundant parameters. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/RedundantParens.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Reports redundant parentheses in terms. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/UnresolvedArendPattern.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Reports patterns that do not resolve into constructors 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/AddClarifyingParensIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func n => (2 + (4 div 2)) + 2 -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/AddClarifyingParensIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func n => 2 + 4 div 2 + 2 -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/AddClarifyingParensIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Adds clarifying parentheses to a sequence of binary operators. 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ChangeArgumentExplicitnessIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func mp {A B :<\spot> \Type} (a : A) (b : B) => (a, b) 2 | 3 | \func \infixl 6 {A B : \Type} (p1 p2 : \Sigma A B) => (p1.1, p2.2) 4 | 5 | \func test => mp 1 2 mp 3 4 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ChangeArgumentExplicitnessIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func mp (A B :<\spot> \Type) (a : A) (b : B) => (a, b) 2 | 3 | \func \infixl 6 {A B : \Type} (p1 p2 : \Sigma A B) => (p1.1, p2.2) 4 | 5 | \func test => mp _ _ 1 2 mp _ _ 3 4 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ChangeArgumentExplicitnessIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Changes the explicitness of an argument or a whole telescope 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/CreateLetBindingIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func foo (x : Nat) : Nat => \let a' => x + y \in bar (bar a') 2 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/CreateLetBindingIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func foo (x : Nat) : Nat => bar (bar x + y) 2 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/CreateLetBindingIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Extracts expression to a let-binding. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ExtractExpressionToFunctionIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func foo (x y : Nat) : Nat => foo-lemma x y 2 | 3 | \func foo-lemma (x y : Nat) : Nat => x + y 4 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ExtractExpressionToFunctionIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func foo (x y : Nat) : Nat => x + y 2 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ExtractExpressionToFunctionIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Extracts expression to a function. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/GenerateElimMissingClausesIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \import Data.Bool 2 | 3 | \func foo (n m : Nat) : Bool \elim n 4 | | 0 => {?} 5 | | suc n => {?} 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/GenerateElimMissingClausesIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \import Data.Bool 2 | 3 | \func foo (n m : Nat) : Bool => {?} 4 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/GenerateElimMissingClausesIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Generates pattern matching clauses using \\elim 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/GenerateFunctionFromGoalIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func foo {A : \Type} (x : List A) : x = nil => foo-lemma x 2 | 3 | \func foo-lemma {A : \Type} (x : List A) : x = nil => {?} 4 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/GenerateFunctionFromGoalIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func foo {A : \Type} (x : List A) : x = nil => {?} 2 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/GenerateFunctionFromGoalIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Creates a function from a goal. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/GenerateMissingClausesIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \import Data.Bool 2 | 3 | \func foo (n m : Nat) : Bool 4 | | 0, 0 => {?} 5 | | 0, suc m => {?} 6 | | suc n, 0 => {?} 7 | | suc n, suc m => {?} 8 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/GenerateMissingClausesIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \import Data.Bool 2 | 3 | \func foo (n m : Nat) : Bool => {?} 4 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/GenerateMissingClausesIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Generates pattern matching clauses 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ImplementFieldsInCoClauseIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \record A (x y : Nat) 2 | 3 | \record B (z w : Nat) \extends A 4 | 5 | \func foo : B \cowith 6 | | A { 7 | | y => {?} 8 | | x => {?} 9 | } 10 | | z => 0 11 | | w => {?} -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ImplementFieldsInCoClauseIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \record A (x y : Nat) 2 | 3 | \record B (z w : Nat) \extends A 4 | 5 | \func foo : B \cowith 6 | | A { 7 | | y => {?} 8 | } 9 | | z => 0 10 | | w => {?} -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ImplementFieldsInCoClauseIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Creates empty implementations for fields not implemented in a coclauses block correponding to a super class. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/RemoveClarifyingParensIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func n => 2 + 4 div 2 + 2 -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/RemoveClarifyingParensIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func n => (2 + (4 div 2)) + 2 -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/RemoveClarifyingParensIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Removes clarifying parentheses from a sequence of binary operators. 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceBracketsIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func foo {a : Nat} => 0 -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceBracketsIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func foo (a : Nat) => 0 -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceBracketsIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Replaces the brackets or the parentheses associated with this element from "(" and ") to "{" and "}" and vice versa 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceMetaWithResultIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func +-comm-fin (m n : Nat) (f : Fin (m + n)) : Fin (n + m) => 2 | transportInv Fin +-comm f -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceMetaWithResultIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func +-comm-fin (m n : Nat) (f : Fin (m + n)) : Fin (n + m) => 2 | rewrite +-comm f -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceMetaWithResultIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Replaces the meta under the cursor with its result. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceWithNormalFormIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func number : Nat => 114514 -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceWithNormalFormIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func number : Nat => 233 * 450 - 336 + 100 * 100 -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceWithNormalFormIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Replaces the selected expression with its weak-head-normal-form.
4 | It may fail due to type errors. 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceWithShortNameIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \module M \where { 2 | \func f => 1 3 | } 4 | 5 | \module M2 \where { 6 | \open M (f) 7 | 8 | \func f2 => f 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceWithShortNameIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \module M \where { 2 | \func f => 1 3 | } 4 | 5 | \module M2 \where { 6 | \func f2 => M.f 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ReplaceWithShortNameIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Replaces long name with open command and short name. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/SplitAtomPatternIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func isLessThan2 (a : Nat) : Bool 2 | | 0 => true 3 | | 1 => {?} 4 | | suc (suc a) => {?} -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/SplitAtomPatternIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func isLessThan2 (a : Nat) : Bool 2 | | 0 => true 3 | | suc a => {?} -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/SplitAtomPatternIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Splits a pattern-matching variable whose type is an inductive data type. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/SwapInfixOperatorArgumentsIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func p : 2 = 1 + 1 => idp -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/SwapInfixOperatorArgumentsIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func p : 1 + 1 = 2 => idp -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/SwapInfixOperatorArgumentsIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Swaps arguments of an infix operator. 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapInGoalIntention/after.ard.template: -------------------------------------------------------------------------------- 1 | \func number : Nat => {?(114 + 514)} -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapInGoalIntention/before.ard.template: -------------------------------------------------------------------------------- 1 | \func number : Nat => 114 + 514 -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapInGoalIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Replaces the selected expression with a goal containing it. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/starters/intellij-arend.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.intellij 4 | intellij-arend 5 | 1.0 6 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/ArendTestCase.kt: -------------------------------------------------------------------------------- 1 | package org.arend 2 | 3 | interface ArendTestCase { 4 | 5 | fun getTestDataPath(): String 6 | 7 | companion object { 8 | const val testResourcesPath = "src/test/resources" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/ParsingTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend 2 | 3 | import com.intellij.testFramework.ParsingTestCase 4 | import org.arend.parser.ArendParserDefinition 5 | 6 | class ParsingTest : ParsingTestCase("org/arend/parser/fixtures", ArendFileTypeInstance.defaultExtension, ArendParserDefinition()) { 7 | 8 | override fun getTestDataPath() = "src/test/resources" 9 | 10 | fun testSimpleDef() = doTest(true, true) 11 | 12 | fun testColonExprs() = doTest(true, true) 13 | 14 | fun testMixedReplCommandAndColon() = doTest(true, true) 15 | 16 | fun testMixedReplCommandAndColon2() = doTest(true, true) 17 | 18 | fun testReplTypeCommand() = doTest(true, true) 19 | 20 | fun testBareExprCommand() = doTest(true, true) 21 | } 22 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/actions/ArendExtendWordSelectionTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.actions 2 | 3 | import com.intellij.openapi.actionSystem.IdeActions 4 | import org.arend.ArendTestBase 5 | 6 | class ArendExtendWordSelectionTest: ArendTestBase() { 7 | fun doTest(before: String, finalRange: String, count: Int = 1) { 8 | InlineFile(before).withCaret() 9 | for (i in 1..count) myFixture.performEditorAction(IdeActions.ACTION_EDITOR_SELECT_WORD_AT_CARET) 10 | val selectionModel = myFixture.editor.selectionModel 11 | val t = myFixture.file.text.substring(selectionModel.selectionStart, selectionModel.selectionEnd) 12 | assert (t == finalRange) 13 | } 14 | 15 | fun testSmartSelection() = doTest(""" 16 | \data List {X : \Type} 17 | | nil 18 | | \infixr 1 :: X (List {X}) 19 | | \infixl 2 && (List {X}) X 20 | 21 | \func length {X : \Type} (x : List {X}) : List {X} 22 | | y :: x :: x{-caret-}2 && x1 => y :: (x :: x2) && x1 23 | """, "x :: x2 && x1", 3) 24 | } -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/codeInsight/ArendBracesTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.codeInsight 2 | 3 | import org.arend.ArendTestBase 4 | import org.junit.Ignore 5 | 6 | @Ignore("I don't know why, but these test fail even though it works fine in the actual IDE") 7 | class ArendBracesTest : ArendTestBase() { 8 | private fun checkDoNothing(code: String, type: Char) { 9 | val file = InlineFile(code).withCaret() 10 | val text = file.text 11 | myFixture.type(type) 12 | myFixture.checkResult(text) 13 | } 14 | 15 | fun `test goal braces`() = checkDoNothing("""\func tony => {?{-caret-}}""", '}') 16 | 17 | fun `test simple braces`() = checkDoNothing("""\func beta => lamb {{-caret-}}""", '}') 18 | 19 | fun `test parenthesis`() = checkDoNothing("""\func tonyxu => (tql{-caret-})""", ')') 20 | 21 | fun `test goal expr braces`() = checkDoNothing("""\func tonyxty/ => {?(hStacks){-caret-}}""", '}') 22 | } -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/codeInsight/completion/ArendPreludeCompletionTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.codeInsight.completion 2 | 3 | class ArendPreludeCompletionTest : ArendCompletionTestBase() { 4 | 5 | fun `test prelude`() = checkSingleCompletion("""\func _ : z{-caret-}""", "zero") 6 | 7 | fun `test prelude expr`() = checkSingleCompletion("""z{-caret-}""", "zero") 8 | } 9 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/formatting/ArendFormatterTestBase.kt: -------------------------------------------------------------------------------- 1 | package org.arend.formatting 2 | 3 | import com.intellij.openapi.actionSystem.IdeActions 4 | import org.arend.ArendTestBase 5 | import org.intellij.lang.annotations.Language 6 | 7 | abstract class ArendFormatterTestBase : ArendTestBase() { 8 | 9 | protected fun checkNewLine(@Language("Arend") code: String, @Language("Arend") resultingContent: String, count: Int = 1) { 10 | val c = code.trimIndent() 11 | InlineFile(c).withCaret() 12 | for (i in 1..count) myFixture.type('\n') 13 | 14 | testCaret(resultingContent) 15 | } 16 | 17 | protected fun checkReformat(@Language("Arend") code: String, @Language("Arend") resultingContent: String = code) { 18 | InlineFile(code.trimIndent()) 19 | 20 | myFixture.performEditorAction(IdeActions.ACTION_EDITOR_REFORMAT) 21 | 22 | myFixture.checkResult(resultingContent.trimIndent(), true) 23 | } 24 | } -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/inspection/ArendInspectionSuppressorTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.inspection 2 | 3 | import com.intellij.codeInspection.NonAsciiCharactersInspection 4 | import org.arend.ArendTestBase 5 | import org.arend.inspection.PartiallyInfixOperatorPrefixFormInspectionTest.Companion.infixWarning 6 | 7 | class ArendInspectionSuppressorTest : ArendTestBase() { 8 | override fun setUp() { 9 | super.setUp() 10 | myFixture.enableInspections(NonAsciiCharactersInspection::class.java) 11 | } 12 | 13 | fun `test non ascii chars are not reported`() { 14 | InlineFile(""" 15 | \open Nat (+) 16 | \func \infixr 8 o \alias \infixr 8 ∘ {A B C : \Type} (g : B -> C) (f : A -> B) => \lam x => g (f x) 17 | \func ++ => (${infixWarning("+ 1")}) ∘ (${infixWarning("+ 1")}) 18 | """.trimIndent()) 19 | myFixture.checkHighlighting() 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/inspection/InspectionUtilTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.inspection 2 | 3 | import com.intellij.testFramework.fixtures.CodeInsightTestFixture 4 | import org.arend.fileTreeFromText 5 | 6 | internal fun doWarningsCheck(myFixture: CodeInsightTestFixture, contents: String, typecheck: Boolean = false) { 7 | val fileTree = fileTreeFromText(contents) 8 | fileTree.create(myFixture.project, myFixture.findFileInTempDir(".")) 9 | myFixture.configureFromTempProjectFile("Main.ard") 10 | if (typecheck) { 11 | myFixture.doHighlighting() 12 | } 13 | myFixture.checkHighlighting(true, false, false) 14 | } 15 | 16 | internal fun doWeakWarningsCheck(myFixture: CodeInsightTestFixture, contents: String, typecheck: Boolean = false) { 17 | val fileTree = fileTreeFromText(contents) 18 | fileTree.create(myFixture.project, myFixture.findFileInTempDir(".")) 19 | myFixture.configureFromTempProjectFile("Main.ard") 20 | if (typecheck) { 21 | myFixture.doHighlighting() 22 | } 23 | myFixture.checkHighlighting(false, false, true) 24 | } 25 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/inspection/NameShadowingInspectionTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.inspection 2 | 3 | import org.arend.quickfix.QuickFixTestBase 4 | import org.arend.util.ArendBundle 5 | 6 | class NameShadowingInspectionTest : QuickFixTestBase() { 7 | 8 | fun testTypeTele() = doWarningsCheck(myFixture, """ 9 | \data List (A : \Type) 10 | | nil 11 | | \infixr 5 :: A (List A) 12 | \data AllC {A : \Type} (P : A -> A -> \Prop) (l : List A) \elim l 13 | | nil => allC-nil 14 | | :: x nil => allC-single 15 | | :: x (:: y l) => allC-cons {${nsWarning("x")} : \Type} 16 | """) 17 | 18 | fun testGlobalDefinitions() = doWarningsCheck(myFixture, """ 19 | \data D | con {I : \Set} 20 | """) 21 | 22 | companion object { 23 | fun nsWarning(text: String) = "$text" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/inspection/PartiallyInfixOperatorPrefixFormInspectionTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.inspection 2 | 3 | import org.arend.quickfix.QuickFixTestBase 4 | import org.arend.util.ArendBundle 5 | 6 | class PartiallyInfixOperatorPrefixFormInspectionTest : QuickFixTestBase() { 7 | 8 | fun testFunc() = doWarningsCheck(myFixture, """ 9 | \data List (A : \Type) 10 | | nil 11 | | \infixr 5 :: A (List A) 12 | 13 | \func map {A B : \Type} (f : A -> B) (l : List A) : List B \elim l 14 | | nil => nil 15 | | :: a l => f a :: map f l 16 | 17 | \func f (xs : List Nat) => map (${infixWarning("Nat.+ 3")}) xs 18 | """) 19 | 20 | fun testData() = doWarningsCheck(myFixture, """ 21 | \data \infix 5 And (A B : Nat) 22 | 23 | \func f => ${infixWarning("And 6")} 24 | """) 25 | 26 | companion object { 27 | fun infixWarning(text: String) = "$text" 28 | } 29 | } -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/inspection/RedundantParameterInspectionTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.inspection 2 | 3 | import org.arend.quickfix.QuickFixTestBase 4 | import org.arend.util.ArendBundle 5 | 6 | class RedundantParameterInspectionTest : QuickFixTestBase() { 7 | override fun setUp() { 8 | super.setUp() 9 | myFixture.enableInspections(RedundantParameterInspection::class.java) 10 | } 11 | 12 | fun testFunc() = doWarningsCheck(myFixture, """ 13 | \func f (${rpnWarning("x")} : Nat) => 0 14 | """) 15 | 16 | companion object { 17 | fun rpnWarning(text: String) = "$text" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/intention/BaseIntentionTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.intention 2 | 3 | import org.arend.quickfix.QuickFixTestBase 4 | import org.arend.util.ArendBundle 5 | 6 | class BaseIntentionTest : QuickFixTestBase() { 7 | fun `test wrap in goal with the end marker`() { 8 | configure(""" 9 | \data List 10 | | nil 11 | | cons Nat List 12 | 13 | \func plus (a b : Prelude.Nat) => a Nat.+ b 14 | 15 | \func lol => {-selection-}cons (plus 2 3) (cons (plus 2 3) nil){-caret-}{-end_selection-} 16 | """) 17 | assertNotNull(myFixture.findSingleIntention(ArendBundle.message("arend.expression.wrapInGoal"))) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/navigation/ArendFileNavigationContributorTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.navigation 2 | 3 | import com.intellij.navigation.ChooseByNameContributor 4 | import org.arend.ArendTestBase 5 | 6 | class ArendFileNavigationContributorTest : ArendTestBase() { 7 | fun `test contains files with metas from arend-lib`() { 8 | withStdLib { 9 | assertNotEmpty(getByName("Meta.ard")) 10 | assertNotEmpty(getByName("Function.Meta.ard")) 11 | assertNotEmpty(getByName("Paths.Meta.ard")) 12 | } 13 | } 14 | 15 | private fun getByName(name: String): List = 16 | ChooseByNameContributor.FILE_EP_NAME.extensionList.asSequence() 17 | .flatMap { it.getItemsByName(name, name, project, true).map { it.name!! } } 18 | .toList() 19 | } -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/AddReturnKeywordQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class AddReturnKeywordQuickFixTest: QuickFixTestBase() { 6 | 7 | fun testAddReturnKeyword1() = typedQuickFixTest( 8 | ArendBundle.message("arend.return.add"), """ 9 | \func test => \case{-caret-} 1 \with { zero => 0 | suc y => y } 10 | """, """ 11 | \func test => \case 1 \return {?}{-caret-} \with { zero => 0 | suc y => y } 12 | """) 13 | 14 | fun testAddReturnKeyword2() = typedQuickFixTest( 15 | ArendBundle.message("arend.return.add"), """ 16 | \func test => \case{-caret-} 1, 1 \with { z, w => 0 } 17 | """, """ 18 | \func test => \case 1, 1 \return {?}{-caret-} \with { z, w => 0 } 19 | """) 20 | } 21 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/DataUniverseQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class DataUniverseQuickFixTest : QuickFixTestBase() { 6 | 7 | fun testUniverse() = typedQuickFixTest(ArendBundle.message("arend.universe.replace"), """ 8 | \data D : \Set0{-caret-} 9 | | con \Set0 10 | """, """ 11 | \data D : \1-Type1 12 | | con \Set0 13 | """) 14 | } 15 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/FieldDependencyQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class FieldDependencyQuickFixTest: QuickFixTestBase() { 6 | 7 | fun testFieldDependency1() = typedQuickFixTest( 8 | ArendBundle.message("arend.field.dependency"), """ 9 | \record R (x : Nat) (p : x = x) 10 | \func f (r : R) => \new r { | {-caret-}x => 2 } 11 | """, """ 12 | \record R (x : Nat) (p : x = x) 13 | \func f (r : R) => \new r { | x => 2 | p => {?}{-caret-} } 14 | """) 15 | 16 | fun testFieldDependency2() = typedQuickFixTest( 17 | ArendBundle.message("arend.field.dependency"), """ 18 | \record R (x : Nat) (p : x = x) 19 | \func f (r : R 2) => \new r { | {-caret-}x => 2 } 20 | """, """ 21 | \record R (x : Nat) (p : x = x) 22 | \func f (r : R 2) => \new r { | x => 2 | p => {?}{-caret-} } 23 | """) 24 | } 25 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/LambdaInferenceQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class LambdaInferenceQuickFixTest : QuickFixTestBase() { 6 | 7 | fun testLambdaInference1() = typedQuickFixTest( 8 | ArendBundle.message("arend.argument.inference.parameter"), """ 9 | \func f => \lam x{-caret-} {y} => x 10 | """, """ 11 | \func f => \lam (x : {?}) {y} => x 12 | """ 13 | ) 14 | 15 | fun testLambdaInference2() = typedQuickFixTest( 16 | ArendBundle.message("arend.argument.inference.parameter"), """ 17 | \func f => \lam (x : {?}) {y{-caret-}} => x 18 | """, """ 19 | \func f => \lam (x : {?}) {y : {?}} => x 20 | """ 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/RemoveClassifyingFieldQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class RemoveClassifyingFieldQuickFixTest: QuickFixTestBase() { 6 | 7 | fun testRemoveClassifyingField() = typedQuickFixTest( 8 | ArendBundle.message("arend.classifying.remove"), """ 9 | \record C (n : Nat) (\classifying{-caret-} A : \Type) | a : A -> 0 = n 10 | """, """ 11 | \record C (n : Nat) (A : \Type) | a : A -> 0 = n 12 | """) 13 | } 14 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/RemoveIgnoredLevelsQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class RemoveIgnoredLevelsQuickFixTest: QuickFixTestBase() { 6 | 7 | fun testRemoveIgnoredLevels() = typedQuickFixTest( 8 | ArendBundle.message("arend.remove.levels"), """ 9 | \func foo (x : Nat) => x{-caret-} \levels 0 0 10 | """, """ 11 | \func foo (x : Nat) => x 12 | """) 13 | } 14 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/RemoveLevelQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class RemoveLevelQuickFixTest : QuickFixTestBase() { 6 | 7 | fun testRemoveLevel() = typedQuickFixTest( 8 | ArendBundle.message("arend.expression.removeLevel"), """ 9 | \data Empty 10 | 11 | \func test : \level{-caret-} Empty (Path.inProp {Empty}) => {?} 12 | """, """ 13 | \data Empty 14 | 15 | \func test : Empty => {?} 16 | """) 17 | } 18 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/RemoveNoClassifyingKeywordQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class RemoveNoClassifyingKeywordQuickFixTest: QuickFixTestBase() { 6 | 7 | fun testRemoveNoClassifyingKeyword() = typedQuickFixTest( 8 | ArendBundle.message("arend.noclassifying.remove"), """ 9 | \class D{-caret-} \noclassifying 10 | """, """ 11 | \class D 12 | """) 13 | } 14 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/RemoveStrictKeywordQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class RemoveStrictKeywordQuickFixTest: QuickFixTestBase() { 6 | 7 | fun testRemoveStrictKeyword() = typedQuickFixTest( 8 | ArendBundle.message("arend.remove.strict"), """ 9 | \data D (\strict{-caret-} A : \Type) 10 | """, """ 11 | \data D (A : \Type) 12 | """) 13 | } 14 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/RemoveTruncatedKeywordQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class RemoveTruncatedKeywordQuickFixTest: QuickFixTestBase() { 6 | 7 | fun testRemoveTruncatedKeywordQuickFix1() = typedQuickFixTest( 8 | ArendBundle.message("arend.truncated.remove"), """ 9 | \truncated{-caret-} \data D 10 | """, """ 11 | \data D 12 | """) 13 | 14 | fun testRemoveTruncatedKeywordQuickFix2() = typedQuickFixTest( 15 | ArendBundle.message("arend.truncated.remove"), """ 16 | \truncated \data D : \1-Type{-caret-} 17 | | con1 18 | | con2 19 | | con3 20 | """, """ 21 | \data D : \1-Type 22 | | con1 23 | | con2 24 | | con3 25 | """) 26 | } 27 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/RemoveTruncatedUniverseQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class RemoveTruncatedUniverseQuickFixTest: QuickFixTestBase() { 6 | 7 | fun testRemoveTruncatedUniverse() = typedQuickFixTest( 8 | ArendBundle.message("arend.truncated.remove"), """ 9 | \truncated{-caret-} \data D 10 | """, """ 11 | \data D 12 | """) 13 | } 14 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/RemoveUseLevelQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class RemoveUseLevelQuickFixTest: QuickFixTestBase() { 6 | 7 | fun testRemoveUseLevel1() = typedQuickFixTest( 8 | ArendBundle.message("arend.remove.useLevel"), """ 9 | \data D 10 | \where { 11 | \use \level{-caret-} proof (x y : D) : x = y 12 | } 13 | """, """ 14 | \data D 15 | \where { 16 | } 17 | """ 18 | ) 19 | 20 | fun testRemoveUseLevel2() = typedQuickFixTest( 21 | ArendBundle.message("arend.remove.useLevel"), """ 22 | \data D 23 | \where 24 | \use \level{-caret-} proof (x y : D) : x = y 25 | """, """ 26 | \data D 27 | 28 | """ 29 | ) 30 | } 31 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/quickfix/TruncatedDataQuickFixTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.quickfix 2 | 3 | import org.arend.util.ArendBundle 4 | 5 | class TruncatedDataQuickFixTest: QuickFixTestBase() { 6 | 7 | fun testFuncLevelTest() = typedQuickFixTest( 8 | ArendBundle.message("arend.truncatedData.changeKeyword"), """ 9 | \truncated \data Trunc (A : \Type) : \Prop | in A 10 | \func test {A : \Type} (p : \Pi (a a' : A) -> a = a') (t : Trunc A) : \level A p => \case t \with { | in a{-caret-} => a } 11 | """, """ 12 | \truncated \data Trunc (A : \Type) : \Prop | in A 13 | \lemma test {A : \Type} (p : \Pi (a a' : A) -> a = a') (t : Trunc A) : \level A p => \case t \with {| in a => a } 14 | """) 15 | } 16 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/search/ArendProofSearchInsertTest.kt: -------------------------------------------------------------------------------- 1 | package org.arend.search 2 | 3 | import org.arend.ArendTestBase 4 | import org.arend.fileTreeFromText 5 | import org.arend.search.proof.ProofSearchUI.Companion.insertDefinition 6 | import org.arend.search.proof.generateProofSearchResults 7 | 8 | class ArendProofSearchInsertTest : ArendTestBase() { 9 | fun testCheckInsert() { 10 | val result = fileTreeFromText(""" 11 | \data Bool 12 | 13 | \func foo : Nat -> Bool => {?} 14 | \func lol => {-caret-} 15 | """.trimIndent()) 16 | result.createAndOpenFileWithCaretMarker() 17 | val caret = myFixture.editor.caretModel.currentCaret 18 | 19 | typecheck() 20 | val results = generateProofSearchResults(project, "Nat").filterNotNull().toList() 21 | assertTrue(results.size == 1) 22 | 23 | insertDefinition(project, results[0].def, caret) 24 | myFixture.checkResult(""" 25 | \data Bool 26 | 27 | \func foo : Nat -> Bool => {?} 28 | \func lol => (foo) 29 | """.trimIndent()) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/kotlin/org/arend/tracer/ArendTraceTestBase.kt: -------------------------------------------------------------------------------- 1 | package org.arend.tracer 2 | 3 | import org.arend.ArendTestBase 4 | import org.arend.error.DummyErrorReporter 5 | import org.arend.resolving.PsiConcreteProvider 6 | import org.arend.term.concrete.Concrete 7 | import org.intellij.lang.annotations.Language 8 | 9 | abstract class ArendTraceTestBase : ArendTestBase() { 10 | protected fun doTrace(@Language("Arend") code: String): ArendTracingData { 11 | InlineFile(code).withCaret() 12 | val (expression, definitionRef) = 13 | ArendTraceAction.getElementAtCursor(myFixture.file, myFixture.editor)!! 14 | val definition = PsiConcreteProvider(project, DummyErrorReporter.INSTANCE, null, true) 15 | .getConcrete(definitionRef) as Concrete.Definition 16 | return ArendTraceAction.runTracingTypechecker(project, definition, expression) 17 | } 18 | 19 | protected fun getFirstEntry(tracingData: ArendTracingData) = 20 | tracingData.trace.entries.getOrNull(tracingData.firstEntryIndex) 21 | } -------------------------------------------------------------------------------- /src/test/resources/org/arend/arend-lib/arend.yaml: -------------------------------------------------------------------------------- 1 | sourcesDir: src -------------------------------------------------------------------------------- /src/test/resources/org/arend/arend-lib/src/Function.ard: -------------------------------------------------------------------------------- 1 | \func id {A : \Type} => \lam (x : A) => x 2 | 3 | \func -o {A B C : \Type} (f : A -> B) => \lam (g : B -> C) x => g (f x) 4 | 5 | \func o- {A B C : \Type} (g : B -> C) => \lam (f : A -> B) x => g (f x) 6 | 7 | \func \infixr 8 o {A B C : \Type} (g : B -> C) (f : A -> B) => \lam x => g (f x) 8 | 9 | \func iterl {A : \Type} (f : A -> A) (n : Nat) (a : A) : A \elim n 10 | | 0 => a 11 | | suc n => iterl f n (f a) 12 | 13 | \func iterr {A : \Type} (f : A -> A) (n : Nat) (a : A) : A \elim n 14 | | 0 => a 15 | | suc n => f (iterr f n a) -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/indented_single_line_comment.ard: -------------------------------------------------------------------------------- 1 | \data Nat 2 | | zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/indented_single_line_comment_after.ard: -------------------------------------------------------------------------------- 1 | \data Nat 2 | -- | zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/multi_line.ard: -------------------------------------------------------------------------------- 1 | \data Nat 2 | | zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/multi_line_after.ard: -------------------------------------------------------------------------------- 1 | -- \data Nat 2 | -- | zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/multi_line_block.ard: -------------------------------------------------------------------------------- 1 | \data Nat 2 | | zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/multi_line_block_after.ard: -------------------------------------------------------------------------------- 1 | \data {-Nat 2 | |-} zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/multi_line_block_uncomment.ard: -------------------------------------------------------------------------------- 1 | \data {-Nat 2 | |-} zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/multi_line_block_uncomment_after.ard: -------------------------------------------------------------------------------- 1 | \data Nat 2 | | zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/multi_line_uncomment.ard: -------------------------------------------------------------------------------- 1 | -- \data Nat 2 | -- | zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/multi_line_uncomment_after.ard: -------------------------------------------------------------------------------- 1 | \data Nat 2 | | zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/single_line.ard: -------------------------------------------------------------------------------- 1 | \data Nat 2 | |zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/single_line_after.ard: -------------------------------------------------------------------------------- 1 | -- \data Nat 2 | |zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/single_line_block.ard: -------------------------------------------------------------------------------- 1 | \data Nat 2 | |zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/single_line_block_after.ard: -------------------------------------------------------------------------------- 1 | \data {--}Nat 2 | |zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/single_line_block_uncomment.ard: -------------------------------------------------------------------------------- 1 | \data {--}Nat 2 | |zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/single_line_block_uncomment_after.ard: -------------------------------------------------------------------------------- 1 | \data Nat 2 | |zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/single_line_uncomment.ard: -------------------------------------------------------------------------------- 1 | -- \data Nat 2 | |zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/single_line_uncomment_after.ard: -------------------------------------------------------------------------------- 1 | \data Nat 2 | |zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/single_line_uncomment_with_space.ard: -------------------------------------------------------------------------------- 1 | -- \data Nat 2 | |zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/commenter/fixtures/single_line_uncomment_with_space_after.ard: -------------------------------------------------------------------------------- 1 | \data Nat 2 | |zero 3 | | suc Nat 4 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/parser/fixtures/BareExprCommand.ard: -------------------------------------------------------------------------------- 1 | 114514 -------------------------------------------------------------------------------- /src/test/resources/org/arend/parser/fixtures/BareExprCommand.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | ArendReplLine(REPL_LINE) 3 | ArendNewExpr(NEW_EXPR) 4 | ArendArgumentAppExpr(ARGUMENT_APP_EXPR) 5 | ArendAtomFieldsAcc(ATOM_FIELDS_ACC) 6 | ArendAtom(ATOM) 7 | PsiElement(NUMBER)('114514') -------------------------------------------------------------------------------- /src/test/resources/org/arend/parser/fixtures/ColonExprs.ard: -------------------------------------------------------------------------------- 1 | \data List (A : \Type) 2 | | nil | \infixr 5 :: A (List A) 3 | \func \infixr 6 ++ {A : \Type} (a b : List A) : List A \elim a 4 | | nil => b 5 | | :: a as => a :: (as ++ b) 6 | -------------------------------------------------------------------------------- /src/test/resources/org/arend/parser/fixtures/MixedReplCommandAndColon.ard: -------------------------------------------------------------------------------- 1 | :type :: -------------------------------------------------------------------------------- /src/test/resources/org/arend/parser/fixtures/MixedReplCommandAndColon.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | ArendReplLine(REPL_LINE) 3 | PsiElement(REPL_COMMAND)(':type') 4 | PsiWhiteSpace(' ') 5 | ArendNewExpr(NEW_EXPR) 6 | ArendArgumentAppExpr(ARGUMENT_APP_EXPR) 7 | ArendAtomFieldsAcc(ATOM_FIELDS_ACC) 8 | ArendAtom(ATOM) 9 | ArendLiteral(LITERAL) 10 | ArendLongName(LONG_NAME) 11 | ArendRefIdentifier(REF_IDENTIFIER) 12 | PsiElement(ID)('::') -------------------------------------------------------------------------------- /src/test/resources/org/arend/parser/fixtures/MixedReplCommandAndColon2.ard: -------------------------------------------------------------------------------- 1 | :type (::, ::) -------------------------------------------------------------------------------- /src/test/resources/org/arend/parser/fixtures/ReplTypeCommand.ard: -------------------------------------------------------------------------------- 1 | :type 114514 -------------------------------------------------------------------------------- /src/test/resources/org/arend/parser/fixtures/ReplTypeCommand.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | ArendReplLine(REPL_LINE) 3 | PsiElement(REPL_COMMAND)(':type') 4 | PsiWhiteSpace(' ') 5 | ArendNewExpr(NEW_EXPR) 6 | ArendArgumentAppExpr(ARGUMENT_APP_EXPR) 7 | ArendAtomFieldsAcc(ATOM_FIELDS_ACC) 8 | ArendAtom(ATOM) 9 | PsiElement(NUMBER)('114514') -------------------------------------------------------------------------------- /src/test/resources/org/arend/parser/fixtures/SimpleDef.ard: -------------------------------------------------------------------------------- 1 | \func yukio => 520 -------------------------------------------------------------------------------- /src/test/resources/org/arend/parser/fixtures/SimpleDef.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | ArendStat(STAT) 3 | ArendDefFunction(DEF_FUNCTION) 4 | ArendCompositeElementImpl(FUNCTION_KW) 5 | PsiElement(\func)('\func') 6 | PsiWhiteSpace(' ') 7 | ArendDefIdentifier(DEF_IDENTIFIER) 8 | PsiElement(ID)('yukio') 9 | PsiWhiteSpace(' ') 10 | ArendFunctionBody(FUNCTION_BODY) 11 | PsiElement(=>)('=>') 12 | PsiWhiteSpace(' ') 13 | ArendNewExpr(NEW_EXPR) 14 | ArendArgumentAppExpr(ARGUMENT_APP_EXPR) 15 | ArendAtomFieldsAcc(ATOM_FIELDS_ACC) 16 | ArendAtom(ATOM) 17 | PsiElement(NUMBER)('520') -------------------------------------------------------------------------------- /src/test/resources/org/arend/yaml/arend.yaml: -------------------------------------------------------------------------------- 1 | langVersion: 1.10 2 | sourcesDir: src 3 | dependencies: [] 4 | binariesDir: bin --------------------------------------------------------------------------------