├── .github └── workflows │ └── check.yml ├── .gitignore ├── LICENSE ├── README.md ├── README.zh_CN.md ├── build.gradle.kts ├── changelog ├── 1.0.0.md └── static │ ├── add_int_bool.png │ ├── colored_console.png │ ├── default_project.png │ ├── error_reporting.gif │ ├── hex_int.png │ ├── integer_u8_infer_add.png │ ├── lambda_variables.gif │ ├── optimize_imports.gif │ ├── refresh.svg │ ├── remove_param.gif │ ├── run_validation.png │ ├── specs_link.gif │ ├── toolwindow.png │ ├── type_annotation_error.png │ └── wrap_cast.gif ├── docs ├── install_plugin.md ├── static │ ├── add-configure.png │ ├── configure-panel.png │ ├── img.png │ ├── img_1.png │ ├── img_2.png │ ├── img_3.png │ ├── init.png │ ├── pycharm_move_lang.png │ ├── pycharm_plugin_update.png │ ├── pycharm_welcome_plugins.png │ ├── pycharm_welcome_screen.png │ ├── run-button.png │ └── select-sui-path.png └── update_plugin.md ├── gradle-223.properties ├── gradle-231.properties ├── gradle-232.properties ├── gradle-233.properties ├── gradle-241.properties ├── gradle-242.properties ├── gradle-243.properties ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── intellij-move.main.iml ├── intellij-move.plugin.iml ├── settings.gradle.kts ├── src ├── main │ ├── grammars │ │ ├── MoveLexer.flex │ │ └── MoveParser.bnf │ ├── java │ │ └── org │ │ │ └── sui │ │ │ └── ide │ │ │ └── typing │ │ │ └── MoveTextFieldTypedHandler.java │ ├── kotlin │ │ └── org │ │ │ └── sui │ │ │ ├── bytecode │ │ │ ├── DecompileSuiMvFileAction.kt │ │ │ ├── FetchSuiPackageAction.kt │ │ │ ├── FetchSuiPackageDialog.kt │ │ │ ├── SuiBytecodeFileType.kt │ │ │ ├── SuiBytecodeNotificationProvider.kt │ │ │ └── SuiDecompiler.kt │ │ │ ├── cli │ │ │ ├── BuildDirectoryWatcher.kt │ │ │ ├── Consts.kt │ │ │ ├── LibraryRootsProvider.kt │ │ │ ├── MoveFileHyperlinkFilter.kt │ │ │ ├── MovePackage.kt │ │ │ ├── MoveProject.kt │ │ │ ├── MoveProjectTaskQueueService.kt │ │ │ ├── MoveProjectsService.kt │ │ │ ├── MoveProjectsSyncTask.kt │ │ │ ├── MvConstants.kt │ │ │ ├── OnMoveTomlCreatedFileListener.kt │ │ │ ├── PackageAddresses.kt │ │ │ ├── PluginProjectDisposable.kt │ │ │ ├── ProcessProgressListener.kt │ │ │ ├── externalLinter │ │ │ │ ├── CompilerErrors.kt │ │ │ │ ├── ExternalLinter.kt │ │ │ │ ├── MvExternalLinterConfigurable.kt │ │ │ │ ├── MvExternalLinterProjectSettingsService.kt │ │ │ │ └── RsExternalLinterWidget.kt │ │ │ ├── externalSystem │ │ │ │ ├── MoveExternalSystemProjectAware.kt │ │ │ │ └── MoveSettingsFilesService.kt │ │ │ ├── manifest │ │ │ │ ├── AptosConfigYaml.kt │ │ │ │ ├── MoveToml.kt │ │ │ │ ├── SuiConfigYaml.kt │ │ │ │ └── TomlDependency.kt │ │ │ ├── runConfigurations │ │ │ │ ├── AptosBuildTaskRunner.kt │ │ │ │ ├── AptosCommandLine.kt │ │ │ │ ├── AptosRunState.kt │ │ │ │ ├── CommandConfigurationBase.kt │ │ │ │ ├── MvCapturingProcessHandler.kt │ │ │ │ ├── SuiBuildTaskRunner.kt │ │ │ │ ├── SuiCommandLine.kt │ │ │ │ ├── SuiRunState.kt │ │ │ │ ├── Utils.kt │ │ │ │ ├── aptos │ │ │ │ │ ├── Aptos.kt │ │ │ │ │ ├── AptosCommandConfigurationType.kt │ │ │ │ │ ├── AptosTestConsoleBuilder.kt │ │ │ │ │ ├── AptosTransactionConfigurationType.kt │ │ │ │ │ ├── CommandConfigurationHandler.kt │ │ │ │ │ ├── FunctionCall.kt │ │ │ │ │ ├── FunctionCallConfigurationBase.kt │ │ │ │ │ ├── FunctionCallConfigurationEditor.kt │ │ │ │ │ ├── FunctionCallParser.kt │ │ │ │ │ ├── FunctionParametersPanel.kt │ │ │ │ │ ├── RunAptosCommandActionBase.kt │ │ │ │ │ ├── cmd │ │ │ │ │ │ ├── AptosCommandConfiguration.kt │ │ │ │ │ │ ├── AptosCommandConfigurationEditor.kt │ │ │ │ │ │ └── AptosCommandConfigurationFactory.kt │ │ │ │ │ ├── run │ │ │ │ │ │ ├── RunCommandConfiguration.kt │ │ │ │ │ │ ├── RunCommandConfigurationFactory.kt │ │ │ │ │ │ └── RunCommandConfigurationHandler.kt │ │ │ │ │ └── view │ │ │ │ │ │ ├── ViewCommandConfiguration.kt │ │ │ │ │ │ ├── ViewCommandConfigurationFactory.kt │ │ │ │ │ │ └── ViewCommandConfigurationHandler.kt │ │ │ │ ├── buildtool │ │ │ │ │ ├── AptosBuildAdapterBase.kt │ │ │ │ │ ├── AptosBuildContext.kt │ │ │ │ │ ├── AptosBuildEventsConverter.kt │ │ │ │ │ ├── AptosBuildManager.kt │ │ │ │ │ └── Utils.kt │ │ │ │ ├── producers │ │ │ │ │ ├── AptosCommandLineFromContext.kt │ │ │ │ │ ├── CommandConfigurationProducerBase.kt │ │ │ │ │ ├── SuiCommandLineFromContext.kt │ │ │ │ │ ├── aptos │ │ │ │ │ │ ├── AptosTestCommandConfigurationProducer.kt │ │ │ │ │ │ ├── FunctionCallConfigurationProducerBase.kt │ │ │ │ │ │ ├── RunCommandConfigurationProducer.kt │ │ │ │ │ │ └── ViewCommandConfigurationProducer.kt │ │ │ │ │ └── sui │ │ │ │ │ │ ├── FunctionCallConfigurationProducerBase.kt │ │ │ │ │ │ ├── RunCommandConfigurationProducer.kt │ │ │ │ │ │ ├── SuiTestCommandConfigurationProducer.kt │ │ │ │ │ │ └── ViewCommandConfigurationProducer.kt │ │ │ │ ├── sui │ │ │ │ │ ├── CommandConfigurationHandler.kt │ │ │ │ │ ├── FunctionCall.kt │ │ │ │ │ ├── FunctionCallConfigurationBase.kt │ │ │ │ │ ├── FunctionCallConfigurationEditor.kt │ │ │ │ │ ├── FunctionCallParser.kt │ │ │ │ │ ├── FunctionParametersPanel.kt │ │ │ │ │ ├── RunSuiCommandActionBase.kt │ │ │ │ │ ├── Sui.kt │ │ │ │ │ ├── SuiCommandConfigurationType.kt │ │ │ │ │ ├── SuiTestConsoleBuilder.kt │ │ │ │ │ ├── SuiTransactionConfigurationType.kt │ │ │ │ │ ├── cmd │ │ │ │ │ │ ├── SuiCommandConfiguration.kt │ │ │ │ │ │ ├── SuiCommandConfigurationEditor.kt │ │ │ │ │ │ └── SuiCommandConfigurationFactory.kt │ │ │ │ │ ├── run │ │ │ │ │ │ ├── RunCommandConfiguration.kt │ │ │ │ │ │ ├── RunCommandConfigurationFactory.kt │ │ │ │ │ │ └── RunCommandConfigurationHandler.kt │ │ │ │ │ └── view │ │ │ │ │ │ ├── ViewCommandConfiguration.kt │ │ │ │ │ │ ├── ViewCommandConfigurationFactory.kt │ │ │ │ │ │ └── ViewCommandConfigurationHandler.kt │ │ │ │ └── test │ │ │ │ │ ├── AptosTestConsoleProperties.kt │ │ │ │ │ ├── AptosTestLocator.kt │ │ │ │ │ ├── AptosTestRunState.kt │ │ │ │ │ ├── SuiTestConsoleProperties.kt │ │ │ │ │ ├── SuiTestEventsConverter.kt │ │ │ │ │ ├── SuiTestLocator.kt │ │ │ │ │ └── SuiTestRunState.kt │ │ │ ├── sdks │ │ │ │ ├── AptosSdk.kt │ │ │ │ ├── AptosSdksSettingsService.kt │ │ │ │ ├── DownloadAptosSdkDialog.kt │ │ │ │ ├── DownloadAptosSdkTask.kt │ │ │ │ ├── DownloadSuiSdkDialog.kt │ │ │ │ ├── DownloadSuiSdkTask.kt │ │ │ │ ├── SuiSdk.kt │ │ │ │ └── SuiSdksSettingsService.kt │ │ │ ├── sentryReporter │ │ │ │ ├── SentryContexts.kt │ │ │ │ └── SentryErrorReporter.kt │ │ │ ├── settings │ │ │ │ ├── MvProjectSettingsService.kt │ │ │ │ ├── MvProjectSettingsServiceBase.kt │ │ │ │ ├── PerProjectAptosConfigurable.kt │ │ │ │ ├── PerProjectSuiConfigurable.kt │ │ │ │ ├── VersionLabel.kt │ │ │ │ ├── aptos │ │ │ │ │ └── ChooseAptosCliPanel.kt │ │ │ │ └── sui │ │ │ │ │ └── ChooseSuiCliPanel.kt │ │ │ ├── tests │ │ │ │ └── NamedAddressService.kt │ │ │ ├── toolwindow │ │ │ │ ├── AptosToolWindow.kt │ │ │ │ ├── MoveEntrypointMouseAdapter.kt │ │ │ │ ├── MoveProjectsTree.kt │ │ │ │ ├── MoveProjectsTreeStructure.kt │ │ │ │ └── SuiToolWindow.kt │ │ │ ├── util │ │ │ │ └── RsCommandLineEditor.kt │ │ │ └── utils.kt │ │ │ ├── ide │ │ │ ├── MoveIcons.kt │ │ │ ├── MvBreadcrumbsProvider.kt │ │ │ ├── MvCommenter.kt │ │ │ ├── MvHighlighter.kt │ │ │ ├── actions │ │ │ │ ├── CreateMoveFileAction.kt │ │ │ │ ├── DownloadSuiSDKAction.kt │ │ │ │ ├── GetActiveAddressAction.kt │ │ │ │ ├── GetGasAction.kt │ │ │ │ ├── MoveEditSettingsAction.kt │ │ │ │ ├── OpenObjectListAction.kt │ │ │ │ ├── OpenSettingsAction.kt │ │ │ │ ├── OpenSwitchAddressDialogAction.kt │ │ │ │ ├── OpenSwitchEnvsDialogAction.kt │ │ │ │ ├── RefreshMoveProjectsAction.kt │ │ │ │ └── RsRunExternalLinterAction.kt │ │ │ ├── annotator │ │ │ │ ├── AptosCompilerMessage.kt │ │ │ │ ├── HighlightingAnnotator.kt │ │ │ │ ├── MvAnnotationHolder.kt │ │ │ │ ├── MvAnnotatorBase.kt │ │ │ │ ├── MvErrorAnnotator.kt │ │ │ │ ├── MvSyntaxErrorAnnotator.kt │ │ │ │ ├── RsExternalLinterPass.kt │ │ │ │ ├── RsExternalLinterUtils.kt │ │ │ │ ├── RsHighlightingPassFactoryRegistrar.kt │ │ │ │ └── fixes │ │ │ │ │ ├── ItemSpecSignatureFix.kt │ │ │ │ │ ├── RemoveRedundantParenthesesFix.kt │ │ │ │ │ └── WrapWithParensExprFix.kt │ │ │ ├── colors │ │ │ │ ├── MvColor.kt │ │ │ │ └── MvColorSettingsPage.kt │ │ │ ├── dialog │ │ │ │ ├── AddressDialog.kt │ │ │ │ ├── EnvDialog.kt │ │ │ │ └── ObjectDialog.kt │ │ │ ├── docs │ │ │ │ └── MvDocumentationProvider.kt │ │ │ ├── folding │ │ │ │ └── MvFoldingBuilder.kt │ │ │ ├── formatter │ │ │ │ ├── MoveFmtBlock.kt │ │ │ │ ├── MvAlignmentStrategy.kt │ │ │ │ ├── MvFmtContext.kt │ │ │ │ ├── MvFormattingModelBuilder.kt │ │ │ │ ├── blocks │ │ │ │ │ └── SyntheticRsFmtBlock.kt │ │ │ │ ├── impl │ │ │ │ │ ├── alignment.kt │ │ │ │ │ ├── indent.kt │ │ │ │ │ ├── spacing.kt │ │ │ │ │ └── utils.kt │ │ │ │ └── settings │ │ │ │ │ ├── MoveCodeStyleMainPanel.kt │ │ │ │ │ ├── MoveCodeStyleSettings.kt │ │ │ │ │ └── MoveLanguageCodeStyleSettingsProvider.kt │ │ │ ├── hints │ │ │ │ ├── DeclarationRangeHandler.kt │ │ │ │ ├── FunctionParameterInfoHandler.kt │ │ │ │ ├── InlayParameterHints.kt │ │ │ │ ├── MvInlayParameterHintsProvider.kt │ │ │ │ ├── StructLiteralFieldsInfoHandler.kt │ │ │ │ ├── TypeParameterInfoHandler.kt │ │ │ │ └── type │ │ │ │ │ ├── MvInlayTypeHintsProvider.kt │ │ │ │ │ └── MvTypeHintsPresentationFactory.kt │ │ │ ├── inspections │ │ │ │ ├── FieldInitShorthandInspection.kt │ │ │ │ ├── InvalidModuleDeclarationInspection.kt │ │ │ │ ├── MvAbilityCheckInspection.kt │ │ │ │ ├── MvExternalLinterInspection.kt │ │ │ │ ├── MvLocalInspectionTool.kt │ │ │ │ ├── MvMissingAcquiresInspection.kt │ │ │ │ ├── MvNamingInspection.kt │ │ │ │ ├── MvTypeCheckInspection.kt │ │ │ │ ├── MvUnresolvedReferenceInspection.kt │ │ │ │ ├── MvUnusedAcquiresTypeInspection.kt │ │ │ │ ├── MvUnusedImportInspection.kt │ │ │ │ ├── MvUnusedVariableInspection.kt │ │ │ │ ├── PhantomTypeParameterInspection.kt │ │ │ │ ├── RedundantTypeCastInspection.kt │ │ │ │ ├── ReplaceWithMethodCallInspection.kt │ │ │ │ ├── UnusedTestSignerInspection.kt │ │ │ │ ├── compilerV2 │ │ │ │ │ ├── ReplaceWithIndexExprInspection.kt │ │ │ │ │ └── fixes │ │ │ │ │ │ └── ReplaceWithIndexExprFix.kt │ │ │ │ ├── fixes │ │ │ │ │ ├── AddAcquiresFix.kt │ │ │ │ │ ├── AddPublicModifierFix.kt │ │ │ │ │ ├── EnableCompilerV2FeatureFix.kt │ │ │ │ │ ├── FieldShorthandFix.kt │ │ │ │ │ ├── IntegerCastFix.kt │ │ │ │ │ ├── PhantomFix.kt │ │ │ │ │ ├── RemoveAcquiresFix.kt │ │ │ │ │ ├── RemoveParameterFix.kt │ │ │ │ │ ├── RemoveRedundantCastFix.kt │ │ │ │ │ ├── RemoveTestSignerFix.kt │ │ │ │ │ ├── RenameFix.kt │ │ │ │ │ └── ReplaceWithMethodCallFix.kt │ │ │ │ └── imports │ │ │ │ │ ├── AutoImportFix.kt │ │ │ │ │ ├── BasePathType.kt │ │ │ │ │ ├── ImportAnalyzer.kt │ │ │ │ │ ├── UseItem.kt │ │ │ │ │ └── ui.kt │ │ │ ├── intentions │ │ │ │ ├── ChopListIntention.kt │ │ │ │ ├── ListIntention.kt │ │ │ │ ├── MvElementBaseIntentionAction.kt │ │ │ │ └── RemoveCurlyBracesIntention.kt │ │ │ ├── lineMarkers │ │ │ │ ├── CommandLineMarkerContributor.kt │ │ │ │ └── ItemSpecsLineMarkerProvider.kt │ │ │ ├── liveTemplates │ │ │ │ └── MvContextType.kt │ │ │ ├── navigation │ │ │ │ └── goto │ │ │ │ │ ├── MvNamedElementsVisitor.kt │ │ │ │ │ ├── MvNavigationContributorBase.kt │ │ │ │ │ ├── MvStructNavigationContributor.kt │ │ │ │ │ └── MvSymbolNavigationContributor.kt │ │ │ ├── newProject │ │ │ │ ├── MoveLangProjectOpenProcessor.kt │ │ │ │ ├── MoveProjectGenerator.kt │ │ │ │ ├── MoveProjectGeneratorPeer.kt │ │ │ │ ├── ProjectInitializationSteps.kt │ │ │ │ └── projectActivity │ │ │ │ │ ├── AlwaysRefreshProjectsAfterOpen.kt │ │ │ │ │ └── PreImportedModuleStartupActivity.kt │ │ │ ├── notifications │ │ │ │ ├── InvalidBlockchainCliConfiguration.kt │ │ │ │ ├── MvEditorNotificationProvider.kt │ │ │ │ ├── MvNotifications.kt │ │ │ │ ├── NoMoveProjectDetectedNotificationProvider.kt │ │ │ │ ├── RsExternalLinterSlowRunNotifier.kt │ │ │ │ ├── RsExternalLinterTooltipService.kt │ │ │ │ └── Utils.kt │ │ │ ├── presentation │ │ │ │ ├── PresentationInfo.kt │ │ │ │ └── ty.kt │ │ │ ├── refactoring │ │ │ │ ├── MvImportOptimizer.kt │ │ │ │ ├── MvNamesValidator.kt │ │ │ │ ├── MvRenameFileProcessor.kt │ │ │ │ ├── MvRenameProcessor.kt │ │ │ │ ├── RefactoringSupportProvider.kt │ │ │ │ └── toml │ │ │ │ │ ├── MvRenameAddressProcessor.kt │ │ │ │ │ └── TomlRenameHandler.kt │ │ │ ├── search │ │ │ │ ├── MvFindUsagesProvider.kt │ │ │ │ ├── MvUsageTypeProvider.kt │ │ │ │ ├── MvWordsScanner.kt │ │ │ │ ├── NamedAddressFindUsagesHandlerFactory.kt │ │ │ │ └── NamedAddressUsageTypeProvider.kt │ │ │ ├── structureView │ │ │ │ ├── ItemTypeSorter.kt │ │ │ │ ├── MvPsiStructureViewFactory.kt │ │ │ │ ├── MvStructureViewModel.kt │ │ │ │ └── MvStructureViewTreeElement.kt │ │ │ ├── typing │ │ │ │ ├── MvAngleBracketsHandler.kt │ │ │ │ ├── MvBraceMatcher.kt │ │ │ │ ├── MvEnterInLineCommentHandler.kt │ │ │ │ ├── MvQuoteHandler.kt │ │ │ │ └── MvTypedHandler.kt │ │ │ ├── utils │ │ │ │ ├── FunctionSignature.kt │ │ │ │ └── imports │ │ │ │ │ ├── ImportCandidate.kt │ │ │ │ │ ├── ImportCandidateCollector.kt │ │ │ │ │ ├── ImportUtils.kt │ │ │ │ │ └── UseStmtWrapper.kt │ │ │ └── wordSelection │ │ │ │ ├── MvListSelectionHandler.kt │ │ │ │ ├── MvStringSelectionHandler.kt │ │ │ │ └── MvTypeParamBoundListHandler.kt │ │ │ ├── lang │ │ │ ├── MoveFile.kt │ │ │ ├── MoveFileType.kt │ │ │ ├── MoveLanguage.kt │ │ │ ├── MoveParserDefinition.kt │ │ │ ├── core │ │ │ │ ├── MoveParserUtil.kt │ │ │ │ ├── MvElementType.kt │ │ │ │ ├── MvPsiPattern.kt │ │ │ │ ├── MvTokenType.kt │ │ │ │ ├── completion │ │ │ │ │ ├── CommonCompletionContributor.kt │ │ │ │ │ ├── FuncSignature.kt │ │ │ │ │ ├── KeywordCompletionContributor.kt │ │ │ │ │ ├── LookupElements.kt │ │ │ │ │ ├── LookupElements2.kt │ │ │ │ │ ├── MoveTextFieldCompletionContributor.kt │ │ │ │ │ ├── MvCompletionConfidence.kt │ │ │ │ │ ├── MvLookupElement.kt │ │ │ │ │ ├── Utils.kt │ │ │ │ │ ├── providers │ │ │ │ │ │ ├── AbilitiesCompletionProvider.kt │ │ │ │ │ │ ├── BoolsCompletionProvider.kt │ │ │ │ │ │ ├── CommonCompletionProvider.kt │ │ │ │ │ │ ├── KeywordCompletionProvider.kt │ │ │ │ │ │ ├── MacrosCompletionProvider.kt │ │ │ │ │ │ ├── MethodOrFieldCompletionProvider.kt │ │ │ │ │ │ ├── MvCompletionProvider.kt │ │ │ │ │ │ ├── MvPathCompletionProvider2.kt │ │ │ │ │ │ ├── NamedAddressInUseStmtCompletionProvider.kt │ │ │ │ │ │ ├── PrimitiveTypesCompletionProvider.kt │ │ │ │ │ │ ├── SchemaFieldsCompletionProvider.kt │ │ │ │ │ │ ├── SpecItemCompletionProvider.kt │ │ │ │ │ │ ├── StructFieldsCompletionProvider.kt │ │ │ │ │ │ ├── StructPatCompletionProvider.kt │ │ │ │ │ │ └── VectorLiteralCompletionProvider.kt │ │ │ │ │ └── sort │ │ │ │ │ │ ├── MvCompletionWeigher.kt │ │ │ │ │ │ └── MvCompletionWeighers.kt │ │ │ │ ├── lexer │ │ │ │ │ └── MoveLexer.kt │ │ │ │ ├── psi │ │ │ │ │ ├── AnyBlock.kt │ │ │ │ │ ├── InferenceCachedPathElement.kt │ │ │ │ │ ├── MvAcquireTypesOwner.kt │ │ │ │ │ ├── MvBoolSpecExpr.kt │ │ │ │ │ ├── MvCodeFragment.kt │ │ │ │ │ ├── MvCodeFragmentElementType.kt │ │ │ │ │ ├── MvElement.kt │ │ │ │ │ ├── MvFunctionLike.kt │ │ │ │ │ ├── MvLoopLike.kt │ │ │ │ │ ├── MvModificationTrackerOwner.kt │ │ │ │ │ ├── MvNameIdentifierOwner.kt │ │ │ │ │ ├── MvNamedElement.kt │ │ │ │ │ ├── MvPsiFactory.kt │ │ │ │ │ ├── MvPsiManager.kt │ │ │ │ │ ├── MvPsiTreeChangeListener.kt │ │ │ │ │ ├── MvTypeAnnotationOwner.kt │ │ │ │ │ ├── MvTypeParametersOwner.kt │ │ │ │ │ ├── NamedItemScope.kt │ │ │ │ │ ├── PathExpr.kt │ │ │ │ │ ├── ScopeMslOnlyElement.kt │ │ │ │ │ ├── ext │ │ │ │ │ │ ├── MvAbility.kt │ │ │ │ │ │ ├── MvAddressDef.kt │ │ │ │ │ │ ├── MvAddressRef.kt │ │ │ │ │ │ ├── MvAssertBangExpr.kt │ │ │ │ │ │ ├── MvAttr.kt │ │ │ │ │ │ ├── MvAttrItem.kt │ │ │ │ │ │ ├── MvBinaryExpr.kt │ │ │ │ │ │ ├── MvBinaryOp.kt │ │ │ │ │ │ ├── MvBindingPat.kt │ │ │ │ │ │ ├── MvBorrowExpr.kt │ │ │ │ │ │ ├── MvCallExpr.kt │ │ │ │ │ │ ├── MvCodeBlock.kt │ │ │ │ │ │ ├── MvConst.kt │ │ │ │ │ │ ├── MvDocAndAttributeOwner.kt │ │ │ │ │ │ ├── MvElement.kt │ │ │ │ │ │ ├── MvEnum.kt │ │ │ │ │ │ ├── MvEnumVariant.kt │ │ │ │ │ │ ├── MvExpr.kt │ │ │ │ │ │ ├── MvFQModuleRef.kt │ │ │ │ │ │ ├── MvFieldPat.kt │ │ │ │ │ │ ├── MvFieldPatFull.kt │ │ │ │ │ │ ├── MvFieldsOwner.kt │ │ │ │ │ │ ├── MvFunction.kt │ │ │ │ │ │ ├── MvFunctionParameter.kt │ │ │ │ │ │ ├── MvFunctionParameterList.kt │ │ │ │ │ │ ├── MvGlobalVariable.kt │ │ │ │ │ │ ├── MvIfExpr.kt │ │ │ │ │ │ ├── MvItemElement.kt │ │ │ │ │ │ ├── MvItemSpec.kt │ │ │ │ │ │ ├── MvItemSpecBlock.kt │ │ │ │ │ │ ├── MvItemSpecParameter.kt │ │ │ │ │ │ ├── MvItemSpecRef.kt │ │ │ │ │ │ ├── MvItemsOwner.kt │ │ │ │ │ │ ├── MvLambda.kt │ │ │ │ │ │ ├── MvLetStatement.kt │ │ │ │ │ │ ├── MvLitExpr.kt │ │ │ │ │ │ ├── MvMatchArm.kt │ │ │ │ │ │ ├── MvMatchExpr.kt │ │ │ │ │ │ ├── MvMethodCall.kt │ │ │ │ │ │ ├── MvMethodOrField.kt │ │ │ │ │ │ ├── MvMethodOrPath.kt │ │ │ │ │ │ ├── MvModule.kt │ │ │ │ │ │ ├── MvModuleRef.kt │ │ │ │ │ │ ├── MvModuleSpec.kt │ │ │ │ │ │ ├── MvNamedAddress.kt │ │ │ │ │ │ ├── MvPat.kt │ │ │ │ │ │ ├── MvPath.kt │ │ │ │ │ │ ├── MvQuantExpr.kt │ │ │ │ │ │ ├── MvRefExpr.kt │ │ │ │ │ │ ├── MvRefType.kt │ │ │ │ │ │ ├── MvSchema.kt │ │ │ │ │ │ ├── MvSchemaLit.kt │ │ │ │ │ │ ├── MvSchemaLitField.kt │ │ │ │ │ │ ├── MvSpecBlock.kt │ │ │ │ │ │ ├── MvSpecFunction.kt │ │ │ │ │ │ ├── MvStruct.kt │ │ │ │ │ │ ├── MvStructDotField.kt │ │ │ │ │ │ ├── MvStructField.kt │ │ │ │ │ │ ├── MvStructLitExpr.kt │ │ │ │ │ │ ├── MvStructLitField.kt │ │ │ │ │ │ ├── MvStructOrEnumItemElement.kt │ │ │ │ │ │ ├── MvStructPat.kt │ │ │ │ │ │ ├── MvType.kt │ │ │ │ │ │ ├── MvTypeParameter.kt │ │ │ │ │ │ ├── MvUseAlias.kt │ │ │ │ │ │ ├── MvUseGroup.kt │ │ │ │ │ │ ├── MvUseSpeck.kt │ │ │ │ │ │ ├── MvVisibilityModifier.kt │ │ │ │ │ │ ├── MvVisibilityOwner.kt │ │ │ │ │ │ └── PsiElement.kt │ │ │ │ │ └── impl │ │ │ │ │ │ ├── MvNameIdentifierOwnerImpl.kt │ │ │ │ │ │ └── MvNamedElementImpl.kt │ │ │ │ ├── resolve │ │ │ │ │ ├── LetStmtScope.kt │ │ │ │ │ ├── Processors.kt │ │ │ │ │ └── ref │ │ │ │ │ │ ├── MoveReference.kt │ │ │ │ │ │ ├── MoveReferenceBase.kt │ │ │ │ │ │ ├── MoveReferenceCached.kt │ │ │ │ │ │ ├── MoveReferenceElement.kt │ │ │ │ │ │ ├── MvItemSpecRefReferenceImpl.kt │ │ │ │ │ │ ├── MvResolveCache.kt │ │ │ │ │ │ ├── NamedAddressReference.kt │ │ │ │ │ │ └── Namespace.kt │ │ │ │ ├── resolve2 │ │ │ │ │ ├── ItemResolution.kt │ │ │ │ │ ├── LexicalDeclarations2.kt │ │ │ │ │ ├── NameResolution2.kt │ │ │ │ │ ├── PathKind.kt │ │ │ │ │ ├── PreImportedModuleService.kt │ │ │ │ │ ├── Visibility2.kt │ │ │ │ │ ├── ref │ │ │ │ │ │ ├── MvBindingPatReferenceImpl.kt │ │ │ │ │ │ ├── MvPath2ReferenceImpl.kt │ │ │ │ │ │ ├── MvStructLitFieldReferenceImpl.kt │ │ │ │ │ │ └── RsPathResolveResult.kt │ │ │ │ │ └── util │ │ │ │ │ │ └── PathUtil.kt │ │ │ │ ├── stubs │ │ │ │ │ ├── MoveStubElementType.kt │ │ │ │ │ ├── PlaceholderStub.kt │ │ │ │ │ ├── StubIndexing.kt │ │ │ │ │ ├── StubUtils.kt │ │ │ │ │ ├── Stubs.kt │ │ │ │ │ ├── ext │ │ │ │ │ │ └── StubElement.kt │ │ │ │ │ └── impl │ │ │ │ │ │ ├── MoveAddressDefStub.kt │ │ │ │ │ │ ├── MoveModuleDefStub.kt │ │ │ │ │ │ └── MvFileStub.kt │ │ │ │ └── types │ │ │ │ │ ├── Address.kt │ │ │ │ │ ├── ItemQualName.kt │ │ │ │ │ ├── infer │ │ │ │ │ ├── Acquires.kt │ │ │ │ │ ├── Expectation.kt │ │ │ │ │ ├── ExpectedType.kt │ │ │ │ │ ├── Fold.kt │ │ │ │ │ ├── InferenceContext.kt │ │ │ │ │ ├── Paths.kt │ │ │ │ │ ├── Patterns.kt │ │ │ │ │ ├── RsPsiSubstitution.kt │ │ │ │ │ ├── Substitution.kt │ │ │ │ │ ├── TyLowering.kt │ │ │ │ │ ├── TypeError.kt │ │ │ │ │ ├── TypeFlags.kt │ │ │ │ │ ├── TypeInferenceWalker.kt │ │ │ │ │ └── Unify.kt │ │ │ │ │ └── ty │ │ │ │ │ ├── Ty.kt │ │ │ │ │ ├── TyAdt.kt │ │ │ │ │ ├── TyFunction.kt │ │ │ │ │ ├── TyInfer.kt │ │ │ │ │ ├── TyLambda.kt │ │ │ │ │ ├── TyPrimitive.kt │ │ │ │ │ ├── TyRange.kt │ │ │ │ │ ├── TyReference.kt │ │ │ │ │ ├── TySchema.kt │ │ │ │ │ ├── TyTuple.kt │ │ │ │ │ ├── TyTypeParameter.kt │ │ │ │ │ ├── TyUnknown.kt │ │ │ │ │ └── TyVector.kt │ │ │ ├── index │ │ │ │ ├── MvEntryFunctionIndex.kt │ │ │ │ ├── MvModuleIndex.kt │ │ │ │ ├── MvModuleSpecIndex.kt │ │ │ │ ├── MvNamedElementIndex.kt │ │ │ │ ├── MvTestFunctionIndex.kt │ │ │ │ └── MvViewFunctionIndex.kt │ │ │ └── utils │ │ │ │ └── Diagnostic.kt │ │ │ ├── openapiext │ │ │ ├── BundledAptosManager.kt │ │ │ ├── CommandLineExt.kt │ │ │ ├── Component.kt │ │ │ ├── Editor.kt │ │ │ ├── Logger.kt │ │ │ ├── MvProcessResult.kt │ │ │ ├── PluginPathManager.kt │ │ │ ├── Project.kt │ │ │ ├── ProjectCache.kt │ │ │ ├── StubDataStreams.kt │ │ │ ├── TaskResult.kt │ │ │ ├── common │ │ │ │ └── utils.kt │ │ │ ├── files.kt │ │ │ ├── paths.kt │ │ │ ├── toml.kt │ │ │ ├── ui.kt │ │ │ └── utils.kt │ │ │ ├── stdext │ │ │ ├── Collections.kt │ │ │ ├── Concurrency.kt │ │ │ ├── FileToMoveProjectCache.kt │ │ │ ├── Paths.kt │ │ │ ├── RsResult.kt │ │ │ ├── RunnerAndConfigurationSettings.kt │ │ │ └── Utils.kt │ │ │ ├── toml │ │ │ ├── MoveTomlErrorAnnotator.kt │ │ │ ├── MoveTomlLocalPathReferenceProvider.kt │ │ │ ├── MoveTomlPsiPatterns.kt │ │ │ ├── MoveTomlReferenceContributor.kt │ │ │ ├── MoveTomlUrlReferenceProvider.kt │ │ │ ├── NamedAddressReferenceContributor.kt │ │ │ ├── completion │ │ │ │ ├── MoveTomlCompletionContributor.kt │ │ │ │ ├── MoveTomlKeysCompletionProvider.kt │ │ │ │ └── MoveTomlSchema.kt │ │ │ └── utils.kt │ │ │ └── utils │ │ │ ├── AsyncParameterInfoHandlerBase.kt │ │ │ ├── CacheUtils.kt │ │ │ ├── MvBackgroundTaskQueue.kt │ │ │ ├── PlatformUtils.kt │ │ │ ├── SignatureUtils.kt │ │ │ ├── StringUtils.kt │ │ │ ├── paths.kt │ │ │ ├── refactor.kt │ │ │ └── ui │ │ │ ├── CompletionTextField.kt │ │ │ ├── MoveTextFieldWithCompletion.kt │ │ │ ├── UiUtils.kt │ │ │ └── compat.kt │ └── resources │ │ ├── META-INF │ │ ├── plugin.xml │ │ ├── pluginIcon.svg │ │ └── pluginIcon_dark.svg │ │ ├── colors │ │ ├── MoveDarcula.xml │ │ ├── MoveDefault.xml │ │ └── highlighterDemoText.move │ │ ├── fileTemplates │ │ └── internal │ │ │ ├── Move File.move.ft │ │ │ ├── Move Module.move.ft │ │ │ ├── Move Test Module.move.ft │ │ │ ├── Sui Move File.move.ft │ │ │ ├── Sui Move Module.move.ft │ │ │ └── Sui Move Test Module.move.ft │ │ ├── icons │ │ ├── annotationtype.png │ │ ├── annotationtype@2x.png │ │ ├── aptos.svg │ │ ├── aptos_dark.svg │ │ ├── down.svg │ │ ├── down_dark.svg │ │ ├── enum.svg │ │ ├── enumVariant.svg │ │ ├── externalLinter.svg │ │ ├── externalLinter_dark.svg │ │ ├── gear.svg │ │ ├── gearOff.svg │ │ ├── gearOff_dark.svg │ │ ├── gear_dark.svg │ │ ├── module.svg │ │ ├── move.svg │ │ ├── move_logo.svg │ │ ├── mv.svg │ │ ├── struct.svg │ │ ├── sui.svg │ │ ├── sui_dark.svg │ │ ├── up.svg │ │ └── up_dark.svg │ │ ├── inspectionDescriptions │ │ ├── AddressByValueImport.html │ │ ├── FieldInitShorthand.html │ │ ├── InvalidModuleDeclaration.html │ │ ├── MvAbilityCheck.html │ │ ├── MvConstNaming.html │ │ ├── MvExternalLinter.html │ │ ├── MvFunctionNaming.html │ │ ├── MvLocalBindingNaming.html │ │ ├── MvMissingAcquires.html │ │ ├── MvStructNaming.html │ │ ├── MvTypeCheck.html │ │ ├── MvUnresolvedReference.html │ │ ├── MvUnusedAcquiresType.html │ │ ├── MvUnusedImport.html │ │ ├── MvUnusedVariable.html │ │ ├── PhantomTypeParameter.html │ │ ├── RedundantQualifiedPath.html │ │ ├── RedundantTypeCast.html │ │ ├── ReplaceWithIndexExpr.html │ │ ├── ReplaceWithMethodCall.html │ │ └── UnusedTestSigner.html │ │ ├── intentionDescriptions │ │ ├── ChopAttrArgumentListIntention │ │ │ └── description.html │ │ ├── ChopParameterListIntention │ │ │ └── description.html │ │ ├── ChopStructLiteralIntention │ │ │ └── description.html │ │ ├── ChopStructPatIntention │ │ │ └── description.html │ │ ├── ChopValueArgumentListIntention │ │ │ └── description.html │ │ ├── InlineAddressBlockIntention │ │ │ └── description.html │ │ └── RemoveCurlyBracesIntention │ │ │ └── description.html │ │ ├── liveTemplates │ │ └── Move.xml │ │ └── messages │ │ └── MvBundle.properties └── test │ ├── kotlin │ └── org │ │ └── sui │ │ ├── cli │ │ ├── LoadMoveProjectsTest.kt │ │ ├── externalLinter │ │ │ ├── CompilerErrorsTest.kt │ │ │ └── MvExternalLinterPassTest.kt │ │ ├── externalSystem │ │ │ ├── ImportTreeProjectTest.kt │ │ │ └── MoveExternalSystemProjectAwareTest.kt │ │ ├── filters │ │ │ └── MoveFileHyperlinkFilterTest.kt │ │ ├── module │ │ │ └── MoveLangTreeProjectOpenProcessorTest.kt │ │ ├── runConfigurations │ │ │ ├── CommandConfigurationHandlerTest.kt │ │ │ ├── FunctionCallConfigurationProducerTest.kt │ │ │ └── TestCommandConfigurationProducerTest.kt │ │ └── toolwindow │ │ │ └── MoveProjectsStructureTest.kt │ │ ├── ide │ │ ├── FoldingBuilderTest.kt │ │ ├── MvBreadcrumbsProviderTest.kt │ │ ├── actions │ │ │ └── CreateMoveFileActionTest.kt │ │ ├── annotator │ │ │ ├── HighlightingAnnotatorTest.kt │ │ │ ├── errors │ │ │ │ ├── BuiltInFunctionNameErrorTest.kt │ │ │ │ ├── BuiltinCallErrorTest.kt │ │ │ │ ├── DuplicateMembersErrorTest.kt │ │ │ │ ├── ItemSpecSignatureMismatchErrorTest.kt │ │ │ │ ├── NeedsTypeAnnotationTest.kt │ │ │ │ ├── StructFieldsNumberErrorTest.kt │ │ │ │ ├── TypeParametersNumberErrorTest.kt │ │ │ │ ├── ValueArgumentsNumberErrorTest.kt │ │ │ │ └── fixes │ │ │ │ │ └── ItemSpecSignatureFixTest.kt │ │ │ └── syntaxErrors │ │ │ │ ├── AllowedSpecStatementsTest.kt │ │ │ │ ├── EntryFunCannotHaveReturnValueTest.kt │ │ │ │ ├── InvalidHexStringTest.kt │ │ │ │ ├── InvalidIntegerTest.kt │ │ │ │ ├── NativeStructNotSupportedTest.kt │ │ │ │ ├── RequiredParensForCastExprErrorTest.kt │ │ │ │ ├── SpecFunRequiresReturnValueTest.kt │ │ │ │ ├── compilerV2 │ │ │ │ ├── IndexExprTest.kt │ │ │ │ ├── PublicPackageTest.kt │ │ │ │ └── ReceiverStyleFunctionsTest.kt │ │ │ │ └── fixes │ │ │ │ └── WrapCastExprWithParensFixTest.kt │ │ ├── docs │ │ │ ├── MoveDocumentationProviderTest.kt │ │ │ └── MoveNamedAddressDocumentationTest.kt │ │ ├── formatter │ │ │ ├── AutoIndentTest.kt │ │ │ └── FormatterTest.kt │ │ ├── hints │ │ │ ├── InlayParameterHintsTest.kt │ │ │ ├── InlayTypeHintsTest.kt │ │ │ ├── ParameterInfoHandlerTest.kt │ │ │ ├── StructLiteralFieldsInfoHandlerTest.kt │ │ │ └── TypeParameterInfoHandlerTest.kt │ │ ├── inspections │ │ │ ├── FieldInitShorthandInspectionTest.kt │ │ │ ├── InvalidModuleDeclarationInspectionTest.kt │ │ │ ├── MvAbilityCheckInspectionTest.kt │ │ │ ├── MvMissingAcquiresInspectionTest.kt │ │ │ ├── MvTypeCheckInspectionTest.kt │ │ │ ├── MvUnresolvedReferenceInspectionTest.kt │ │ │ ├── MvUnusedAcquiresTypeInspectionTest.kt │ │ │ ├── MvUnusedImportInspectionTest.kt │ │ │ ├── MvUnusedImportProjectTest.kt │ │ │ ├── MvUnusedVariableInspectionTest.kt │ │ │ ├── PhantomTypeParameterInspectionTest.kt │ │ │ ├── RedundantTypeCastInspectionTest.kt │ │ │ ├── UnusedTestSignerInspectionTest.kt │ │ │ ├── compilerV2 │ │ │ │ ├── ReplaceWithIndexExprInspectionTest.kt │ │ │ │ ├── ReplaceWithMethodCallInspectionProjectTest.kt │ │ │ │ ├── ReplaceWithMethodCallInspectionTest.kt │ │ │ │ └── TypeCheckIndexExprTest.kt │ │ │ ├── fixes │ │ │ │ ├── AcquiresFixTest.kt │ │ │ │ ├── IntegerCastFixTest.kt │ │ │ │ ├── RemoveParameterFixTest.kt │ │ │ │ ├── RemoveRedundantCastFixTest.kt │ │ │ │ └── RenameFixTest.kt │ │ │ ├── imports │ │ │ │ ├── AutoImportFixTest.kt │ │ │ │ ├── AutoImportFixTreeProjectTest.kt │ │ │ │ └── ImportCandidatesTest.kt │ │ │ └── naming_inspections.kt │ │ ├── intentions │ │ │ ├── ChopAttrArgumentListIntentionTest.kt │ │ │ ├── ChopParameterListIntentionTest.kt │ │ │ ├── ChopStructLiteralIntentionTest.kt │ │ │ ├── ChopValueArgumentListIntentionTest.kt │ │ │ └── RemoveCurlyBracesIntentionTest.kt │ │ ├── lineMarkers │ │ │ └── ItemSpecsLineMarkerProviderTest.kt │ │ ├── refactoring │ │ │ ├── RenameAddressTest.kt │ │ │ ├── RenameTest.kt │ │ │ └── optimizeImports │ │ │ │ ├── MergeImportsTest.kt │ │ │ │ ├── OptimizeImportsTest.kt │ │ │ │ ├── OptimizeImportsTestBase.kt │ │ │ │ └── OptimizeImportsUnchangedTest.kt │ │ ├── search │ │ │ ├── FindUsagesNamedModulePathTest.kt │ │ │ └── FindUsagesTest.kt │ │ ├── structureView │ │ │ ├── HidePrivateFunctionsFilterTest.kt │ │ │ ├── HideTestFunctionsFilterTest.kt │ │ │ ├── HideTestOnlyItemsFilterTest.kt │ │ │ ├── StructureViewTest.kt │ │ │ ├── StructureViewTestBase.kt │ │ │ └── StructureViewToggleableActionTestBase.kt │ │ ├── typing │ │ │ ├── BraceMatcherTest.kt │ │ │ ├── EnterInLineCommentHandlerTest.kt │ │ │ ├── MvAngleBraceTypedHandlerTest.kt │ │ │ └── QuotesHandlerTest.kt │ │ └── wordSelection │ │ │ ├── MvListSelectionHandlerTest.kt │ │ │ └── MvStringSelectionHandlerTest.kt │ │ ├── lang │ │ ├── NamedModulePathValuesTest.kt │ │ ├── completion │ │ │ ├── BuiltInsCompletionTest.kt │ │ │ ├── CompletionPrioritiesTest.kt │ │ │ ├── KeywordCompletionTest.kt │ │ │ ├── MvPsiPatternTest.kt │ │ │ ├── PrimitiveTypesCompletionTest.kt │ │ │ ├── compilerV2 │ │ │ │ └── ReceiverStyleCompletionTest.kt │ │ │ ├── lookups │ │ │ │ ├── BuiltInFunctionLookupTest.kt │ │ │ │ └── LookupElementTest.kt │ │ │ └── names │ │ │ │ ├── DotAccessCompletionTest.kt │ │ │ │ ├── FunctionsCompletionTest.kt │ │ │ │ ├── ModulesCompletionTest.kt │ │ │ │ ├── SpecsCompletionTest.kt │ │ │ │ ├── StructsCompletionTest.kt │ │ │ │ ├── VariablesCompletionTest.kt │ │ │ │ └── project │ │ │ │ ├── AddressCompletionProjectTest.kt │ │ │ │ ├── FunctionsCompletionTreeProjectTest.kt │ │ │ │ └── ModulesCompletionProjectTest.kt │ │ ├── lexer │ │ │ ├── LexerTest.kt │ │ │ └── RestartableLexerTest.kt │ │ ├── parser │ │ │ ├── CompleteParsingTest.kt │ │ │ ├── PartialParsingTest.kt │ │ │ └── SpecsParsingTest.kt │ │ ├── resolve │ │ │ ├── MultiResolveTest.kt │ │ │ ├── ResolveFunctionTest.kt │ │ │ ├── ResolveItemsTreeProjectTest.kt │ │ │ ├── ResolveModulesTest.kt │ │ │ ├── ResolveNamedModulePathTreeProjectTest.kt │ │ │ ├── ResolveResourceAccessSpecifiersTest.kt │ │ │ ├── ResolveSpecsTest.kt │ │ │ ├── ResolveStructFieldsTest.kt │ │ │ ├── ResolveStubOnlyTest.kt │ │ │ ├── ResolveTypesTest.kt │ │ │ ├── ResolveVariablesTest.kt │ │ │ └── compilerV2 │ │ │ │ ├── PublicPackageProjectTest.kt │ │ │ │ ├── ReceiverStyleFunctionProjectTest.kt │ │ │ │ └── ReceiverStyleFunctionTest.kt │ │ └── types │ │ │ ├── AcquiresTypesTest.kt │ │ │ ├── CallableTypeTest.kt │ │ │ ├── ExpectedTypeTest.kt │ │ │ ├── ExpressionTypeInferenceTest.kt │ │ │ ├── ExpressionTypesTest.kt │ │ │ ├── PrimitiveTypesTest.kt │ │ │ ├── TypeSubstitutionTest.kt │ │ │ └── compilerV2 │ │ │ ├── IndexExprTypes.kt │ │ │ └── ReceiverStyleFunctionsTest.kt │ │ ├── toml │ │ ├── MoveTomlCompletionProjectTest.kt │ │ ├── MoveTomlCompletionTest.kt │ │ └── MoveTomlErrorAnnotatorTest.kt │ │ └── utils │ │ └── tests │ │ ├── Actions.kt │ │ ├── AptosCliTestFixture.kt │ │ ├── FileTree.kt │ │ ├── HighlightFilterTestBase.kt │ │ ├── InlineFile.kt │ │ ├── MoveDocumentationProviderTestCase.kt │ │ ├── MoveIntentionTestCase.kt │ │ ├── MoveTomlCompletionTestBase.kt │ │ ├── MvFormatterTestBase.kt │ │ ├── MvLexerTestBase.kt │ │ ├── MvLightTestBase.kt │ │ ├── MvProjectTestBase.kt │ │ ├── MvSelectionHandlerTestBase.kt │ │ ├── MvTestBase.kt │ │ ├── MvTypingTestCase.kt │ │ ├── ParameterInfoHandlerTestCase.kt │ │ ├── RunConfigurationProducerTestBase.kt │ │ ├── RunConfigurationUtils.kt │ │ ├── Settings.kt │ │ ├── WithAptosCliTestBase.kt │ │ ├── annotation │ │ ├── AnnotatorTestCase.kt │ │ ├── InspectionProjectTestBase.kt │ │ ├── InspectionTestBase.kt │ │ ├── MvAnnotationTestCase.kt │ │ ├── MvAnnotationTestFixture.kt │ │ └── TestSeverityProvider.kt │ │ ├── base │ │ ├── MoveTestCase.kt │ │ └── TestCase.kt │ │ ├── common.kt │ │ ├── completion │ │ ├── CompletionProjectTestCase.kt │ │ ├── CompletionTestCase.kt │ │ └── MoveCompletionTestFixture.kt │ │ ├── lineMarkers │ │ ├── LineMarkerProviderTestBase.kt │ │ └── LineMarkerTestHelper.kt │ │ ├── parser │ │ └── MoveParsingTestCase.kt │ │ ├── resolve │ │ ├── ResolveProjectTestCase.kt │ │ ├── ResolveTestCase.kt │ │ └── ResolveTestUtils.kt │ │ └── types │ │ └── TypificationTestCase.kt │ └── resources │ ├── META-INF │ └── plugin.xml │ ├── move_toml_project │ ├── .aptos │ │ └── config.yaml │ ├── Move.toml │ └── stdlib │ │ └── debug.move │ └── org │ └── sui │ ├── cli │ └── producers.fixtures │ │ ├── function_call │ │ ├── run_command_for_entry_function_call_with_no_arguments.xml │ │ ├── run_command_for_entry_function_call_with_one_argument.xml │ │ ├── view_command_for_view_function_call_with_no_arguments.xml │ │ └── view_command_for_view_function_call_with_one_argument.xml │ │ └── test │ │ ├── run_tests_for_file_with_multiple_module_single_test_module.xml │ │ ├── run_tests_for_file_with_one_module.xml │ │ ├── run_tests_for_function_if_inside_non_test_only_module.xml │ │ ├── run_tests_for_module_with_test_function.xml │ │ ├── run_tests_for_move_package_from_root.xml │ │ ├── run_tests_for_move_package_from_tests_directory.xml │ │ ├── run_tests_for_move_toml_file.xml │ │ ├── test_run_for_compiler_v2.xml │ │ ├── test_run_for_compiler_v2_without_cli_flag.xml │ │ ├── test_run_for_function.xml │ │ ├── test_run_for_function_dumping_state_on_test_failure.xml │ │ ├── test_run_for_function_skipping_fetch_git_deps.xml │ │ └── test_run_for_module_with_test_functions_inside_sources.xml │ ├── ide │ ├── folding.fixtures │ │ ├── module.move │ │ ├── script.move │ │ └── script_with_parameters.move │ ├── formatter.fixtures │ │ ├── address_block.move │ │ ├── address_block_after.move │ │ ├── blank_lines.move │ │ ├── blank_lines_after.move │ │ ├── chop_wraps.move │ │ ├── chop_wraps_after.move │ │ ├── comments.move │ │ ├── comments_after.move │ │ ├── expressions.move │ │ ├── expressions_after.move │ │ ├── function_parameters.move │ │ ├── function_parameters_after.move │ │ ├── functions.move │ │ ├── functions_after.move │ │ ├── inner_block.move │ │ ├── inner_block_after.move │ │ ├── operators.move │ │ ├── operators_after.move │ │ ├── specs.move │ │ ├── specs_after.move │ │ ├── structs.move │ │ └── structs_after.move │ └── typing │ │ └── lineComment.fixtures │ │ ├── after_outer_doc_comment.move │ │ └── after_outer_doc_comment_after.move │ └── lang │ ├── lexer │ ├── block_comments.move │ └── block_comments.txt │ └── parser │ ├── complete │ ├── access_control.move │ ├── access_control.txt │ ├── addresses.move │ ├── addresses.txt │ ├── annotated_literals.move │ ├── annotated_literals.txt │ ├── assignments.move │ ├── assignments.txt │ ├── attributes.move │ ├── attributes.txt │ ├── comments.move │ ├── comments.txt │ ├── contextual_token_operators.move │ ├── contextual_token_operators.txt │ ├── dot_expressions.move │ ├── dot_expressions.txt │ ├── expressions.move │ ├── expressions.txt │ ├── expressions_angle_brackets.move │ ├── expressions_angle_brackets.txt │ ├── expressions_assignments.move │ ├── expressions_assignments.txt │ ├── expressions_if_else_as.move │ ├── expressions_if_else_as.txt │ ├── expressions_specs.move │ ├── expressions_specs.txt │ ├── friend.move │ ├── friend.txt │ ├── function_calls.move │ ├── function_calls.txt │ ├── function_declarations.move │ ├── function_declarations.txt │ ├── generics.move │ ├── generics.txt │ ├── index_expr.move │ ├── index_expr.txt │ ├── let_patterns.move │ ├── let_patterns.txt │ ├── loops.move │ ├── loops.txt │ ├── macros.move │ ├── macros.txt │ ├── public_package.move │ ├── public_package.txt │ ├── strings.move │ ├── strings.txt │ ├── struct_declarations.move │ ├── struct_declarations.txt │ ├── struct_literals.move │ ├── struct_literals.txt │ ├── use.move │ ├── use.txt │ ├── vectors.move │ ├── vectors.txt │ ├── while_loop_inline_assignment.move │ └── while_loop_inline_assignment.txt │ ├── partial │ ├── assignments.move │ ├── assignments.txt │ ├── dot_exprs.move │ ├── dot_exprs.txt │ ├── empty_script.move │ ├── expressions.move │ ├── expressions.txt │ ├── function_calls.move │ ├── function_calls.txt │ ├── function_signatures.move │ ├── function_signatures.txt │ ├── module_const.move │ ├── module_const.txt │ ├── module_uses.move │ ├── module_uses.txt │ ├── spec.move │ ├── spec.txt │ ├── struct_decls.move │ ├── struct_decls.txt │ ├── struct_fields.move │ ├── struct_fields.txt │ ├── top_level_items.move │ └── top_level_items.txt │ └── specs │ ├── apply.move │ ├── apply.txt │ ├── conditions.move │ ├── conditions.txt │ ├── forall_exists.move │ ├── forall_exists.txt │ ├── pragma.move │ ├── pragma.txt │ ├── scopes.move │ ├── scopes.txt │ ├── spec_file.move │ ├── spec_file.txt │ ├── spec_properties.move │ ├── spec_properties.txt │ ├── spec_statements.move │ ├── spec_statements.txt │ ├── spec_variables.move │ └── spec_variables.txt └── ui-tests └── src ├── main └── kotlin │ └── org │ └── move │ └── ui │ ├── fixtures │ ├── ActionMenuFixture.kt │ ├── DialogFixture.kt │ ├── IdeaFrame.kt │ ├── MoveSettingsPanelFixture.kt │ ├── TextFieldWithBrowseButtonFixture.kt │ └── WelcomeFrame.kt │ └── utils │ ├── RemoteRobotExtension.kt │ └── StepsLogger.kt └── test ├── kotlin └── org │ └── move │ └── ui │ ├── NewProjectTest.kt │ ├── ToolWindowTest.kt │ └── UiTestBase.kt └── resources └── example-packages ├── aptos_package ├── Move.toml └── sources │ └── .gitkeep ├── empty_move_package └── main.move └── sui_package ├── Move.toml └── sources └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .gradle 3 | out/ 4 | build/ 5 | src/main/gen/ 6 | .DS_Store 7 | /dove 8 | deps/ 9 | bin/ 10 | .intellijPlatform 11 | *.log 12 | plugin/* 13 | !/plugin/src/ 14 | /.vscode/settings.json 15 | /gradle/wrapper/chain.crt 16 | /gradle/wrapper/private.pem 17 | .aider* 18 | -------------------------------------------------------------------------------- /changelog/1.0.0.md: -------------------------------------------------------------------------------- 1 | # INTELLIJ SUI MOVE CHANGELOG: 1.0.0 2 | 3 | 22 Nov 2023 4 | 5 | ## Features 6 | 7 | * Support `sui cli` into the IDE. 8 | 9 | -------------------------------------------------------------------------------- /changelog/static/add_int_bool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/add_int_bool.png -------------------------------------------------------------------------------- /changelog/static/colored_console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/colored_console.png -------------------------------------------------------------------------------- /changelog/static/default_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/default_project.png -------------------------------------------------------------------------------- /changelog/static/error_reporting.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/error_reporting.gif -------------------------------------------------------------------------------- /changelog/static/hex_int.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/hex_int.png -------------------------------------------------------------------------------- /changelog/static/integer_u8_infer_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/integer_u8_infer_add.png -------------------------------------------------------------------------------- /changelog/static/lambda_variables.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/lambda_variables.gif -------------------------------------------------------------------------------- /changelog/static/optimize_imports.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/optimize_imports.gif -------------------------------------------------------------------------------- /changelog/static/remove_param.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/remove_param.gif -------------------------------------------------------------------------------- /changelog/static/run_validation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/run_validation.png -------------------------------------------------------------------------------- /changelog/static/specs_link.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/specs_link.gif -------------------------------------------------------------------------------- /changelog/static/toolwindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/toolwindow.png -------------------------------------------------------------------------------- /changelog/static/type_annotation_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/type_annotation_error.png -------------------------------------------------------------------------------- /changelog/static/wrap_cast.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/changelog/static/wrap_cast.gif -------------------------------------------------------------------------------- /docs/install_plugin.md: -------------------------------------------------------------------------------- 1 | # How to install Sui Move Language plugin 2 | 3 | ## 1.1. Install Sui Move Language plugin from fresh IDE 4 | 5 | If this is the first time you've started IDE, you'll see the welcome screen: 6 | 7 | ![welcome_screem](./static/pycharm_welcome_screen.png) 8 | 9 | To install the plugin, select the `Plugins` link from the menu on the left: 10 | 11 | ![plugins](./static/pycharm_welcome_plugins.png) 12 | 13 | If you've been using the IDE previously, choose `File` menu at the top of the window, 14 | and click `Settings...` (or press `Ctrl+Alt+S`). Then select `Plugins` section on the left. 15 | 16 | Search for "Sui Move Lang" and click `Install`: 17 | 18 | ![move_lang](./static/pycharm_move_lang.png) 19 | -------------------------------------------------------------------------------- /docs/static/add-configure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/add-configure.png -------------------------------------------------------------------------------- /docs/static/configure-panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/configure-panel.png -------------------------------------------------------------------------------- /docs/static/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/img.png -------------------------------------------------------------------------------- /docs/static/img_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/img_1.png -------------------------------------------------------------------------------- /docs/static/img_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/img_2.png -------------------------------------------------------------------------------- /docs/static/img_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/img_3.png -------------------------------------------------------------------------------- /docs/static/init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/init.png -------------------------------------------------------------------------------- /docs/static/pycharm_move_lang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/pycharm_move_lang.png -------------------------------------------------------------------------------- /docs/static/pycharm_plugin_update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/pycharm_plugin_update.png -------------------------------------------------------------------------------- /docs/static/pycharm_welcome_plugins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/pycharm_welcome_plugins.png -------------------------------------------------------------------------------- /docs/static/pycharm_welcome_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/pycharm_welcome_screen.png -------------------------------------------------------------------------------- /docs/static/run-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/run-button.png -------------------------------------------------------------------------------- /docs/static/select-sui-path.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/docs/static/select-sui-path.png -------------------------------------------------------------------------------- /docs/update_plugin.md: -------------------------------------------------------------------------------- 1 | # How to update Sui Move Language plugin to a new version 2 | 3 | From the Main Menu on the top, open settings at `File` -> `Settings...` (or press `Ctrl+Alt+S` / `⌘ ,`). 4 | Then select the `Plugins` section from the left sections list. 5 | 6 | ![plugin_update](./static/pycharm_plugin_update.png) 7 | 8 | Click on the `Update` button to download and install new version of the plugin. 9 | -------------------------------------------------------------------------------- /gradle-223.properties: -------------------------------------------------------------------------------- 1 | # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html 2 | # for insight into build numbers and IntelliJ Platform versions. 3 | pluginSinceBuild=223 4 | pluginUntilBuild=223.* 5 | 6 | # IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties 7 | platformType=PC 8 | platformVersion=2022.3 9 | 10 | # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html 11 | # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 12 | platformPlugins = org.toml.lang 13 | verifierIdeVersions=PC-2022.3 -------------------------------------------------------------------------------- /gradle-231.properties: -------------------------------------------------------------------------------- 1 | # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html 2 | # for insight into build numbers and IntelliJ Platform versions. 3 | pluginSinceBuild = 231 4 | pluginUntilBuild=232.* 5 | 6 | # IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties 7 | platformType = PC 8 | platformVersion = 2023.1 9 | 10 | # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html 11 | # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 12 | platformPlugins = org.toml.lang 13 | verifierIdeVersions = PC-2023.1 14 | -------------------------------------------------------------------------------- /gradle-232.properties: -------------------------------------------------------------------------------- 1 | # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html 2 | # for insight into build numbers and IntelliJ Platform versions. 3 | pluginSinceBuild = 232 4 | pluginUntilBuild = 232.* 5 | 6 | # IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties 7 | platformType = PC 8 | platformVersion = 2023.2 9 | 10 | # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html 11 | # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 12 | platformPlugins = org.toml.lang 13 | verifierIdeVersions = PC-2023.2 14 | -------------------------------------------------------------------------------- /gradle-233.properties: -------------------------------------------------------------------------------- 1 | # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html 2 | # for insight into build numbers and IntelliJ Platform versions. 3 | pluginSinceBuild=233 4 | pluginUntilBuild=233.* 5 | # IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties 6 | platformType=PC 7 | platformVersion=2023.3 8 | # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html 9 | # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 10 | platformPlugins=org.toml.lang 11 | verifierIdeVersion=PC-2023.3 12 | -------------------------------------------------------------------------------- /gradle-241.properties: -------------------------------------------------------------------------------- 1 | # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html 2 | # for insight into build numbers and IntelliJ Platform versions. 3 | pluginSinceBuild=241 4 | pluginUntilBuild=241.* 5 | 6 | # IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties 7 | platformType=PC 8 | platformVersion=2024.1 9 | # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html 10 | # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 11 | platformPlugins=org.toml.lang 12 | verifierIdeVersion=PC-2024.1 13 | # https://plugins.jetbrains.com/plugin/227-psiviewer/versions 14 | psiViewerPlugin=PsiViewer:241.14494.158-EAP-SNAPSHOT -------------------------------------------------------------------------------- /gradle-242.properties: -------------------------------------------------------------------------------- 1 | # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html 2 | # for insight into build numbers and IntelliJ Platform versions. 3 | pluginSinceBuild=242 4 | pluginUntilBuild=242.* 5 | # IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties 6 | platformType=PC 7 | platformVersion=242 8 | # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html 9 | # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 10 | platformPlugins=org.toml.lang 11 | verifierIdeVersion=PC-2024.2 12 | #should be false when using EAP builds 13 | useInstaller=false 14 | # https://plugins.jetbrains.com/plugin/227-psiviewer/versions 15 | psiViewerPlugin=PsiViewer:242.4697 -------------------------------------------------------------------------------- /gradle-243.properties: -------------------------------------------------------------------------------- 1 | # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html 2 | # for insight into build numbers and IntelliJ Platform versions. 3 | pluginSinceBuild = 243 4 | pluginUntilBuild = 243.* 5 | 6 | # IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties 7 | platformType = IC 8 | platformVersion = 243.18137-EAP-CANDIDATE-SNAPSHOT 9 | 10 | # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html 11 | # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 12 | platformPlugins = org.toml.lang 13 | 14 | # should be false when using EAP builds 15 | useInstaller=false -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | #kotlin.code.style=official 2 | 3 | # Since kotlin 1.4, stdlib dependency is added by default by kotlin gradle plugin. 4 | # But we don't need it because all necessary kotlin libraries are already bundled into IDE. 5 | # See https://kotlinlang.org/docs/reference/using-gradle.html#dependency-on-the-standard-library for more details 6 | kotlin.stdlib.default.dependency=false 7 | 8 | # Workaround for Kotlin 1.8.20+ 9 | #kotlin.incremental.useClasspathSnapshot=false 10 | 11 | #org.gradle.daemon=false 12 | org.gradle.caching = true 13 | 14 | kotlin.daemon.jvmargs=-Xmx4096m 15 | org.gradle.jvmargs=-Xms512m -Xmx4096m "-XX:MaxMetaspaceSize=512m" 16 | jbrVersion=17.0.7b1000.6 17 | 18 | propertiesPluginEnvironmentNameProperty=shortPlatformVersion 19 | # properties files 20 | # pass ORG_GRADLE_PROJECT_shortPlatformVersion environment variable to overwrite 21 | shortPlatformVersion=243 22 | useInstaller=true 23 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/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.9-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /intellij-move.plugin.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "intellij-sui-move" 2 | 3 | pluginManagement { 4 | repositories { 5 | maven("https://oss.sonatype.org/content/repositories/snapshots/") 6 | gradlePluginPortal() 7 | } 8 | } 9 | 10 | //include("ui-tests") 11 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/bytecode/FetchSuiPackageAction.kt: -------------------------------------------------------------------------------- 1 | package org.sui.bytecode 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent 4 | import org.sui.cli.runConfigurations.sui.RunSuiCommandActionBase 5 | 6 | class FetchSuiPackageAction : RunSuiCommandActionBase("Fetch on-chain package") { 7 | override fun actionPerformed(e: AnActionEvent) { 8 | val project = e.project ?: return 9 | 10 | val parametersDialog = FetchSuiPackageDialog(project) 11 | parametersDialog.show() 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/bytecode/SuiBytecodeFileType.kt: -------------------------------------------------------------------------------- 1 | package org.sui.bytecode 2 | 3 | import com.intellij.openapi.fileTypes.FileType 4 | import org.sui.ide.MoveIcons 5 | 6 | object SuiBytecodeFileType : FileType { 7 | override fun getIcon() = MoveIcons.SUI_LOGO 8 | override fun getName() = "SUI_BYTECODE" 9 | override fun getDefaultExtension() = "mv" 10 | override fun getDescription() = "Sui Move bytecode" 11 | override fun getDisplayName() = "Sui Move bytecode" 12 | override fun isBinary(): Boolean = true 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/BuildDirectoryWatcher.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli 2 | 3 | import com.intellij.openapi.util.io.FileUtil 4 | import com.intellij.openapi.vfs.newvfs.BulkFileListener 5 | import com.intellij.openapi.vfs.newvfs.events.VFileEvent 6 | 7 | class BuildDirectoryWatcher( 8 | private var moveProjects: List, 9 | private val onChange: () -> Unit 10 | ) : BulkFileListener { 11 | 12 | fun setWatchedProjects(moveProjects: List) { 13 | this.moveProjects = moveProjects 14 | } 15 | 16 | override fun after(events: MutableList) { 17 | val buildDirectories = moveProjects.map { FileUtil.join(it.contentRoot.path, "build") } 18 | for (event in events) { 19 | if (buildDirectories.any { event.pathStartsWith(it) }) { 20 | onChange() 21 | return 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/Consts.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli 2 | 3 | import com.intellij.openapi.externalSystem.model.ProjectSystemId 4 | import org.sui.stdext.exists 5 | import java.nio.file.Path 6 | 7 | object Consts { 8 | const val MANIFEST_FILE = "Move.toml" 9 | const val ADDR_PLACEHOLDER = "_" 10 | const val MOVE_COMPILER_V2_ENV = "MOVE_LANGUAGE_V2" 11 | 12 | val PROJECT_SYSTEM_ID = ProjectSystemId("Sui Move") 13 | } 14 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/MoveProjectTaskQueueService.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli 2 | 3 | import com.intellij.openapi.Disposable 4 | import com.intellij.openapi.components.Service 5 | import com.intellij.openapi.components.service 6 | import com.intellij.openapi.progress.Task 7 | import com.intellij.openapi.project.Project 8 | import org.sui.utils.MvBackgroundTaskQueue 9 | 10 | @Service(Service.Level.PROJECT) 11 | class MvProjectTaskQueueService(val project: Project): Disposable { 12 | private val queue = MvBackgroundTaskQueue() 13 | 14 | fun run(task: Task.Backgroundable) = queue.run(task) 15 | 16 | val isEmpty: Boolean get() = queue.isEmpty 17 | 18 | override fun dispose() { 19 | queue.dispose() 20 | } 21 | } 22 | 23 | val Project.taskQueue: MvProjectTaskQueueService get() = service() 24 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/MvConstants.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli 2 | 3 | import com.intellij.openapi.externalSystem.model.ProjectSystemId 4 | import org.sui.stdext.exists 5 | import java.nio.file.Path 6 | 7 | object MvProjectLayout { 8 | val sourcesDirs = arrayOf("sources", "examples", "scripts") 9 | const val testsDir = "tests" 10 | const val buildDir = "build" 11 | 12 | fun dirs(root: Path): List { 13 | val names = listOf(*sourcesDirs, testsDir, buildDir) 14 | return names.map { root.resolve(it) }.filter { it.exists() } 15 | } 16 | } 17 | 18 | object MvConstants { 19 | const val MANIFEST_FILE = "Move.toml" 20 | const val ADDR_PLACEHOLDER = "_" 21 | const val MOVE_COMPILER_V2_ENV = "MOVE_LANGUAGE_V2" 22 | 23 | const val PSI_FACTORY_DUMMY_FILE = "DUMMY_PSI_FACTORY.move" 24 | 25 | val PROJECT_SYSTEM_ID = ProjectSystemId("Sui Move") 26 | } 27 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/PluginProjectDisposable.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli 2 | 3 | import com.intellij.openapi.Disposable 4 | import com.intellij.openapi.components.Service 5 | 6 | @Service(Service.Level.APP) 7 | class PluginApplicationDisposable : Disposable { 8 | override fun dispose() { 9 | } 10 | 11 | override fun toString(): String = "SUI_PLUGIN_DISPOSABLE" 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/ProcessProgressListener.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Use of this source code is governed by the MIT license that can be 3 | * found in the LICENSE file. 4 | */ 5 | 6 | package org.sui.cli 7 | 8 | import com.intellij.build.events.BuildEventsNls 9 | import com.intellij.execution.process.ProcessListener 10 | 11 | @Suppress("UnstableApiUsage") 12 | interface ProcessProgressListener : ProcessListener { 13 | fun error(@BuildEventsNls.Title title: String, @BuildEventsNls.Message message: String) 14 | fun warning(@BuildEventsNls.Title title: String, @BuildEventsNls.Message message: String) 15 | } 16 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/externalLinter/ExternalLinter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Use of this source code is governed by the MIT license that can be 3 | * found in the LICENSE file. 4 | */ 5 | 6 | package org.sui.cli.externalLinter 7 | 8 | enum class ExternalLinter(val title: String) { 9 | COMPILER("Sui Compiler"); 10 | // LINTER("Move Linter"); 11 | 12 | override fun toString(): String = title 13 | 14 | companion object { 15 | @JvmField 16 | val DEFAULT: ExternalLinter = COMPILER 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/manifest/AptosConfigYaml.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.manifest 2 | 3 | import org.yaml.snakeyaml.Yaml 4 | import org.yaml.snakeyaml.error.YAMLException 5 | import java.nio.file.Path 6 | import kotlin.io.path.readText 7 | 8 | data class AptosConfigYaml( 9 | val configYamlPath: Path, 10 | val profiles: Set 11 | ) { 12 | companion object { 13 | fun fromPath(configYamlPath: Path): AptosConfigYaml? { 14 | val yaml = 15 | try { 16 | Yaml().load>(configYamlPath.readText()) 17 | } catch (e: YAMLException) { 18 | // TODO: error notification? 19 | return null 20 | } 21 | 22 | @Suppress("UNCHECKED_CAST") 23 | val profiles = (yaml["profiles"] as? Map<*, *>)?.keys as? Set ?: return null 24 | return AptosConfigYaml(configYamlPath, profiles) 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/manifest/SuiConfigYaml.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.manifest 2 | 3 | import org.yaml.snakeyaml.Yaml 4 | import org.yaml.snakeyaml.error.YAMLException 5 | import java.nio.file.Path 6 | import kotlin.io.path.readText 7 | 8 | data class SuiConfigYaml( 9 | val configYamlPath: Path, 10 | val profiles: Set 11 | ) { 12 | companion object { 13 | fun fromPath(configYamlPath: Path): SuiConfigYaml? { 14 | val yaml = 15 | try { 16 | Yaml().load>(configYamlPath.readText()) 17 | } catch (e: YAMLException) { 18 | // TODO: error notification? 19 | return null 20 | } 21 | @Suppress("UNCHECKED_CAST") 22 | val profiles = (yaml["profiles"] as? Map<*, *>)?.keys as? Set ?: return null 23 | return SuiConfigYaml(configYamlPath, profiles) 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/runConfigurations/Utils.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.runConfigurations 2 | 3 | import com.intellij.openapi.actionSystem.CommonDataKeys 4 | import com.intellij.openapi.actionSystem.DataContext 5 | import com.intellij.openapi.project.Project 6 | import org.sui.cli.MoveProject 7 | import org.sui.cli.moveProjectsService 8 | 9 | val Project.hasMoveProject: Boolean get() = moveProjectsService.allProjects.isNotEmpty() 10 | 11 | fun getAppropriateMoveProject(dataContext: DataContext): MoveProject? { 12 | val moveProjectsService = dataContext.getData(CommonDataKeys.PROJECT)?.moveProjectsService ?: return null 13 | moveProjectsService.allProjects.singleOrNull()?.let { return it } 14 | 15 | dataContext.getData(CommonDataKeys.VIRTUAL_FILE) 16 | ?.let { moveProjectsService.findMoveProjectForFile(it) } 17 | ?.let { return it } 18 | 19 | // return dataContext.getData(AptosToolWindow.SELECTED_CARGO_PROJECT) 20 | // ?: moveProjectsService.allProjects.firstOrNull() 21 | return moveProjectsService.allProjects.firstOrNull() 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/runConfigurations/aptos/FunctionCallConfigurationBase.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.runConfigurations.aptos 2 | 3 | import com.intellij.execution.configurations.ConfigurationFactory 4 | import com.intellij.openapi.project.Project 5 | import org.sui.cli.moveProjectsService 6 | import org.sui.cli.runConfigurations.CommandConfigurationBase 7 | 8 | abstract class FunctionCallConfigurationBase( 9 | project: Project, 10 | factory: ConfigurationFactory, 11 | val configurationHandler: CommandConfigurationHandler, 12 | ) : CommandConfigurationBase(project, factory) { 13 | 14 | fun firstRunShouldOpenEditor(): Boolean { 15 | val moveProject = workingDirectory 16 | ?.let { wdir -> project.moveProjectsService.findMoveProjectForPath(wdir) } ?: return true 17 | val (_, functionCall) = configurationHandler 18 | .parseTransactionCommand(moveProject, command).unwrapOrNull() ?: return true 19 | return functionCall.parametersRequired() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/runConfigurations/aptos/run/RunCommandConfiguration.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.runConfigurations.aptos.run 2 | 3 | import com.intellij.execution.configurations.ConfigurationFactory 4 | import com.intellij.openapi.project.Project 5 | import org.sui.cli.runConfigurations.aptos.FunctionCallConfigurationBase 6 | import org.sui.cli.runConfigurations.aptos.FunctionCallConfigurationEditor 7 | 8 | class RunCommandConfiguration( 9 | project: Project, 10 | factory: ConfigurationFactory 11 | ) : FunctionCallConfigurationBase(project, factory, RunCommandConfigurationHandler()) { 12 | 13 | override fun getConfigurationEditor(): FunctionCallConfigurationEditor { 14 | return FunctionCallConfigurationEditor(project, RunCommandConfigurationHandler()) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/runConfigurations/aptos/view/ViewCommandConfiguration.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.runConfigurations.aptos.view 2 | 3 | import com.intellij.execution.configurations.ConfigurationFactory 4 | import com.intellij.openapi.project.Project 5 | import org.sui.cli.runConfigurations.aptos.FunctionCallConfigurationBase 6 | import org.sui.cli.runConfigurations.aptos.FunctionCallConfigurationEditor 7 | 8 | class ViewCommandConfiguration( 9 | project: Project, 10 | factory: ConfigurationFactory 11 | ) : FunctionCallConfigurationBase(project, factory, ViewCommandConfigurationHandler()) { 12 | 13 | override fun getConfigurationEditor(): FunctionCallConfigurationEditor { 14 | return FunctionCallConfigurationEditor(project, ViewCommandConfigurationHandler()) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/runConfigurations/buildtool/AptosBuildEventsConverter.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.runConfigurations.buildtool 2 | 3 | import com.intellij.build.events.BuildEvent 4 | import com.intellij.build.output.BuildOutputInstantReader 5 | import com.intellij.build.output.BuildOutputParser 6 | import java.util.function.Consumer 7 | 8 | class AptosBuildEventsConverter(private val context: AptosBuildContextBase) : BuildOutputParser { 9 | override fun parse( 10 | line: String, 11 | reader: BuildOutputInstantReader, 12 | messageConsumer: Consumer 13 | ): Boolean { 14 | 15 | return true 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/runConfigurations/producers/AptosCommandLineFromContext.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.runConfigurations.producers 2 | 3 | import com.intellij.psi.PsiElement 4 | import org.sui.cli.runConfigurations.AptosCommandLine 5 | 6 | data class AptosCommandLineFromContext( 7 | val sourceElement: PsiElement, 8 | val configurationName: String, 9 | val commandLine: AptosCommandLine 10 | ) 11 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/runConfigurations/producers/SuiCommandLineFromContext.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.runConfigurations.producers 2 | 3 | import com.intellij.psi.PsiElement 4 | import org.sui.cli.runConfigurations.SuiCommandLine 5 | 6 | data class SuiCommandLineFromContext( 7 | val sourceElement: PsiElement, 8 | val configurationName: String, 9 | val commandLine: SuiCommandLine 10 | ) 11 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/runConfigurations/producers/aptos/RunCommandConfigurationProducer.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.runConfigurations.producers.aptos 2 | 3 | //class RunCommandConfigurationProducer : FunctionCallConfigurationProducerBase() { 4 | // override fun getConfigurationFactory(): ConfigurationFactory = 5 | // RunCommandConfigurationFactory(AptosTransactionConfigurationType.getInstance()) 6 | // 7 | // override fun fromLocation(location: PsiElement, climbUp: Boolean): AptosCommandLineFromContext? = 8 | // RunCommandConfigurationHandler().configurationFromLocation(location) 9 | //} 10 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/runConfigurations/producers/aptos/ViewCommandConfigurationProducer.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.runConfigurations.producers.aptos 2 | 3 | //class ViewCommandConfigurationProducer : FunctionCallConfigurationProducerBase() { 4 | // override fun getConfigurationFactory(): ConfigurationFactory = 5 | // ViewCommandConfigurationFactory(AptosTransactionConfigurationType.getInstance()) 6 | 7 | // override fun fromLocation(location: PsiElement, climbUp: Boolean): AptosCommandLineFromContext? = 8 | // ViewCommandConfigurationHandler().configurationFromLocation(location) 9 | //} 10 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/runConfigurations/sui/run/RunCommandConfiguration.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.runConfigurations.sui.run 2 | 3 | import com.intellij.execution.configurations.ConfigurationFactory 4 | import com.intellij.openapi.project.Project 5 | import org.sui.cli.runConfigurations.sui.FunctionCallConfigurationBase 6 | import org.sui.cli.runConfigurations.sui.FunctionCallConfigurationEditor 7 | 8 | class RunCommandConfiguration( 9 | project: Project, 10 | factory: ConfigurationFactory 11 | ) : FunctionCallConfigurationBase(project, factory, RunCommandConfigurationHandler()) { 12 | 13 | override fun getConfigurationEditor(): FunctionCallConfigurationEditor { 14 | return FunctionCallConfigurationEditor(project, RunCommandConfigurationHandler()) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/runConfigurations/sui/view/ViewCommandConfiguration.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.runConfigurations.sui.view 2 | 3 | import com.intellij.execution.configurations.ConfigurationFactory 4 | import com.intellij.openapi.project.Project 5 | import org.sui.cli.runConfigurations.sui.FunctionCallConfigurationBase 6 | import org.sui.cli.runConfigurations.sui.FunctionCallConfigurationEditor 7 | 8 | class ViewCommandConfiguration( 9 | project: Project, 10 | factory: ConfigurationFactory 11 | ) : FunctionCallConfigurationBase(project, factory, ViewCommandConfigurationHandler()) { 12 | 13 | override fun getConfigurationEditor(): FunctionCallConfigurationEditor { 14 | return FunctionCallConfigurationEditor(project, ViewCommandConfigurationHandler()) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/sdks/AptosSdk.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.sdks 2 | 3 | import com.intellij.openapi.util.SystemInfo 4 | import org.sui.openapiext.BundledAptosManager 5 | import java.io.File 6 | 7 | data class AptosSdk(val sdksDir: String, val version: String) { 8 | val githubArchiveUrl: String 9 | get() { 10 | return "https://github.com/aptos-labs/aptos-core/releases/download" + 11 | "/aptos-cli-v$version/$githubArchiveFileName" 12 | } 13 | 14 | val githubArchiveFileName: String 15 | get() { 16 | return "aptos-cli-$version-${BundledAptosManager.getCurrentOS().title}-x86_64.zip" 17 | } 18 | 19 | val targetFile: File 20 | get() = File(sdksDir, if (SystemInfo.isWindows) "aptos-$version.exe" else "aptos-$version") 21 | } 22 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/tests/NamedAddressService.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.tests 2 | 3 | import org.sui.cli.MoveProject 4 | import org.sui.lang.core.types.Address 5 | import org.sui.lang.core.types.Address.Named 6 | 7 | interface NamedAddressService { 8 | fun getNamedAddress(moveProject: MoveProject, name: String): Address.Named? 9 | } 10 | 11 | class NamedAddressServiceImpl : NamedAddressService { 12 | override fun getNamedAddress(moveProject: MoveProject, name: String): Address.Named? = null 13 | } 14 | 15 | 16 | class NamedAddressServiceTestImpl : NamedAddressService { 17 | val namedAddresses: MutableMap = mutableMapOf() 18 | 19 | override fun getNamedAddress(moveProject: MoveProject, name: String): Named? { 20 | val value = namedAddresses[name] ?: return null 21 | return Named(name, value, moveProject) 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/cli/toolwindow/MoveProjectsTree.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.toolwindow 2 | 3 | import com.intellij.ui.treeStructure.SimpleTree 4 | import org.sui.cli.MoveProject 5 | import javax.swing.tree.DefaultMutableTreeNode 6 | import javax.swing.tree.TreeSelectionModel 7 | 8 | class MoveProjectsTree : SimpleTree() { 9 | 10 | val selectedProject: MoveProject? 11 | get() { 12 | val path = selectionPath ?: return null 13 | if (path.pathCount < 2) return null 14 | val treeNode = path.getPathComponent(1) as? DefaultMutableTreeNode ?: return null 15 | return (treeNode.userObject as? MoveProjectsTreeStructure.MoveSimpleNode.TreeProject)?.moveProject 16 | } 17 | 18 | init { 19 | isRootVisible = false 20 | showsRootHandles = true 21 | emptyText.text = "There are no Move projects to display." 22 | selectionModel.selectionMode = TreeSelectionModel.SINGLE_TREE_SELECTION 23 | // run function 24 | // addMouseListener(MoveEntrypointMouseAdapter()) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/MvCommenter.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide 2 | 3 | import com.intellij.lang.Commenter 4 | 5 | class MvCommenter : Commenter { 6 | override fun getLineCommentPrefix() = "//" 7 | 8 | override fun getBlockCommentPrefix() = "/*" 9 | override fun getBlockCommentSuffix() = "*/" 10 | 11 | override fun getCommentedBlockCommentPrefix() = "*//*" 12 | override fun getCommentedBlockCommentSuffix() = "*//*" 13 | } 14 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/actions/MoveEditSettingsAction.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.actions 2 | 3 | import com.intellij.openapi.actionSystem.ActionUpdateThread 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import com.intellij.openapi.project.DumbAwareAction 6 | import org.sui.cli.settings.PerProjectSuiConfigurable 7 | import org.sui.openapiext.showSettingsDialog 8 | 9 | class MoveEditSettingsAction : DumbAwareAction("Sui Settings") { 10 | 11 | override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT 12 | 13 | override fun update(e: AnActionEvent) { 14 | super.update(e) 15 | e.presentation.isEnabledAndVisible = e.project != null 16 | } 17 | 18 | override fun actionPerformed(e: AnActionEvent) { 19 | e.project?.showSettingsDialog() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/actions/OpenSettingsAction.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.actions 2 | 3 | import com.intellij.openapi.actionSystem.AnAction 4 | import com.intellij.openapi.actionSystem.AnActionEvent 5 | import com.intellij.openapi.options.ShowSettingsUtil 6 | 7 | class OpenSettingsAction : AnAction() { 8 | override fun actionPerformed(e: AnActionEvent) { 9 | val project = e.project 10 | project?.let { 11 | ShowSettingsUtil.getInstance().showSettingsDialog(project, "Sui Move Language") 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/actions/RefreshMoveProjectsAction.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.actions 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent 4 | import com.intellij.openapi.project.DumbAwareAction 5 | import org.sui.cli.moveProjectsService 6 | import org.sui.openapiext.saveAllDocuments 7 | 8 | class RefreshMoveProjectsAction : DumbAwareAction() { 9 | 10 | override fun actionPerformed(e: AnActionEvent) { 11 | val project = e.project ?: return 12 | 13 | saveAllDocuments() 14 | project.moveProjectsService.scheduleProjectsRefresh("Refresh Action called") 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/annotator/RsHighlightingPassFactoryRegistrar.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Use of this source code is governed by the MIT license that can be 3 | * found in the LICENSE file. 4 | */ 5 | 6 | package org.sui.ide.annotator 7 | 8 | import com.intellij.codeHighlighting.TextEditorHighlightingPassFactoryRegistrar 9 | import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar 10 | import com.intellij.openapi.project.Project 11 | 12 | class RsHighlightingPassFactoryRegistrar : TextEditorHighlightingPassFactoryRegistrar { 13 | override fun registerHighlightingPassFactory(registrar: TextEditorHighlightingPassRegistrar, project: Project) { 14 | RsExternalLinterPassFactory(project, registrar) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/annotator/fixes/ItemSpecSignatureFix.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.annotator.fixes 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.intellij.psi.PsiFile 5 | import org.sui.ide.inspections.DiagnosticIntentionFix 6 | import org.sui.ide.utils.getSignature 7 | import org.sui.lang.core.psi.MvItemSpec 8 | import org.sui.lang.core.psi.ext.funcItem 9 | import org.sui.lang.core.psi.psiFactory 10 | 11 | class ItemSpecSignatureFix( 12 | itemSpec: MvItemSpec 13 | ) : 14 | DiagnosticIntentionFix(itemSpec) { 15 | 16 | override fun getText(): String = "Fix item signature" 17 | 18 | override fun invoke(project: Project, file: PsiFile, element: MvItemSpec) { 19 | val itemSpec = startElement 20 | val actualSignature = itemSpec.funcItem?.getSignature() ?: return 21 | 22 | val psiFactory = project.psiFactory 23 | val newSpecSignature = psiFactory.itemSpecSignature(actualSignature) 24 | itemSpec.itemSpecSignature?.replace(newSpecSignature) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/annotator/fixes/RemoveRedundantParenthesesFix.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.annotator.fixes 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.intellij.psi.PsiFile 5 | import org.sui.ide.inspections.DiagnosticIntentionFix 6 | import org.sui.lang.core.psi.MvParensExpr 7 | 8 | class RemoveRedundantParenthesesFix(element: MvParensExpr) : DiagnosticIntentionFix(element) { 9 | 10 | override fun getText(): String = "Remove parentheses from expression" 11 | 12 | override fun invoke(project: Project, file: PsiFile, element: MvParensExpr) { 13 | val wrappedExpr = startElement.expr ?: return 14 | startElement.replace(wrappedExpr) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/formatter/MvFormattingModelBuilder.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.formatter 2 | 3 | import com.intellij.formatting.* 4 | 5 | class MvFormattingModelBuilder : FormattingModelBuilder { 6 | override fun createModel(formattingContext: FormattingContext): FormattingModel { 7 | val formatterBlock = 8 | MoveFmtBlock( 9 | formattingContext.psiElement.node, 10 | null, 11 | null, 12 | Indent.getNoneIndent(), 13 | MvFmtContext.create(formattingContext.codeStyleSettings), 14 | debugName = "FileBlock" 15 | ) 16 | return FormattingModelProvider.createFormattingModelForPsiFile( 17 | formattingContext.containingFile, 18 | formatterBlock, 19 | formattingContext.codeStyleSettings 20 | ) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/formatter/impl/alignment.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.formatter.impl 2 | 3 | import org.sui.ide.formatter.MoveFmtBlock 4 | import org.sui.ide.formatter.MvAlignmentStrategy 5 | import org.sui.lang.MvElementTypes.* 6 | 7 | fun MoveFmtBlock.getAlignmentStrategy(): MvAlignmentStrategy = when (node.elementType) { 8 | FUNCTION_PARAMETER_LIST, VALUE_ARGUMENT_LIST -> 9 | MvAlignmentStrategy 10 | .shared() 11 | .alignUnlessBlockDelim() 12 | .alignIf(ctx.commonSettings.ALIGN_MULTILINE_PARAMETERS) 13 | TYPE_PARAMETER_LIST -> 14 | MvAlignmentStrategy 15 | .wrap() 16 | .alignIf(TYPE_PARAMETER) 17 | else -> MvAlignmentStrategy.NullStrategy 18 | 19 | } 20 | 21 | fun MvAlignmentStrategy.alignUnlessBlockDelim(): MvAlignmentStrategy = 22 | alignIf { c, p, _ -> !c.isDelimiterOfCurrentBlock(p) } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/formatter/settings/MoveCodeStyleMainPanel.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.formatter.settings 2 | 3 | import com.intellij.application.options.TabbedLanguageCodeStylePanel 4 | import com.intellij.psi.codeStyle.CodeStyleSettings 5 | import org.sui.lang.MoveLanguage 6 | 7 | class MoveCodeStyleMainPanel(currentSettings: CodeStyleSettings, settings: CodeStyleSettings) : 8 | TabbedLanguageCodeStylePanel(MoveLanguage, currentSettings, settings) { 9 | 10 | override fun initTabs(settings: CodeStyleSettings) { 11 | addIndentOptionsTab(settings) 12 | // addSpacesTab(settings) 13 | // addWrappingAndBracesTab(settings) 14 | // addBlankLinesTab(settings) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/formatter/settings/MoveCodeStyleSettings.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.formatter.settings 2 | 3 | import com.intellij.psi.codeStyle.CodeStyleSettings 4 | import com.intellij.psi.codeStyle.CustomCodeStyleSettings 5 | 6 | class MoveCodeStyleSettings(container: CodeStyleSettings) : 7 | CustomCodeStyleSettings(MoveCodeStyleSettings::class.java.simpleName, container) 8 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/hints/MvInlayParameterHintsProvider.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.hints 2 | 3 | import com.intellij.codeInsight.hints.InlayInfo 4 | import com.intellij.codeInsight.hints.InlayParameterHintsProvider 5 | import com.intellij.psi.PsiElement 6 | 7 | @Suppress("UnstableApiUsage") 8 | class MvInlayParameterHintsProvider : InlayParameterHintsProvider { 9 | 10 | override fun getDefaultBlackList(): Set = emptySet() 11 | 12 | override fun getParameterHints(element: PsiElement): List { 13 | return InlayParameterHints.provideHints(element) 14 | } 15 | 16 | override fun getInlayPresentation(inlayText: String): String = inlayText 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/inspections/MvUnusedImportInspection.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.inspections 2 | 3 | import com.intellij.codeInsight.daemon.HighlightDisplayKey 4 | import com.intellij.codeInspection.ProblemsHolder 5 | import com.intellij.openapi.project.Project 6 | import com.intellij.profile.codeInspection.InspectionProjectProfileManager 7 | import org.sui.ide.inspections.imports.ImportAnalyzer2 8 | 9 | class MvUnusedImportInspection : MvLocalInspectionTool() { 10 | 11 | override fun buildMvVisitor(holder: ProblemsHolder, isOnTheFly: Boolean) = ImportAnalyzer2(holder) 12 | 13 | @Suppress("CompanionObjectInExtension") 14 | companion object { 15 | fun isEnabled(project: Project): Boolean { 16 | val profile = InspectionProjectProfileManager.getInstance(project).currentProfile 17 | return profile.isToolEnabled(HighlightDisplayKey.find(SHORT_NAME)) 18 | } 19 | 20 | const val SHORT_NAME: String = "MvUnusedImport" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/navigation/goto/MvNavigationContributorBase.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.navigation.goto 2 | 3 | import com.intellij.navigation.ChooseByNameContributorEx 4 | import com.intellij.navigation.GotoClassContributor 5 | import com.intellij.navigation.NavigationItem 6 | import org.sui.lang.core.psi.MvQualNamedElement 7 | 8 | abstract class MvNavigationContributorBase : ChooseByNameContributorEx, 9 | GotoClassContributor { 10 | 11 | override fun getQualifiedName(item: NavigationItem): String? = 12 | (item as? MvQualNamedElement)?.qualName?.editorText() 13 | 14 | override fun getQualifiedNameSeparator(): String = "::" 15 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/newProject/projectActivity/AlwaysRefreshProjectsAfterOpen.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.newProject.projectActivity 2 | 3 | import com.intellij.openapi.diagnostic.logger 4 | import com.intellij.openapi.project.Project 5 | import com.intellij.openapi.startup.ProjectActivity 6 | import org.sui.cli.moveProjectsService 7 | import org.sui.openapiext.common.isUnitTestMode 8 | import org.sui.openapiext.debugInProduction 9 | 10 | class AlwaysRefreshProjectsAfterOpen : ProjectActivity { 11 | override suspend fun execute(project: Project) { 12 | LOG.debugInProduction("activity started") 13 | if (!isUnitTestMode) { 14 | project.moveProjectsService.scheduleProjectsRefresh("IDE project opened") 15 | } else { 16 | LOG.warn("Skip REFRESH [IDE project opened] in unit tests") 17 | } 18 | } 19 | 20 | companion object { 21 | private val LOG = logger() 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/newProject/projectActivity/PreImportedModuleStartupActivity.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.newProject.projectActivity 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.intellij.openapi.startup.StartupActivity 5 | import org.sui.lang.core.resolve2.PreImportedModuleService 6 | 7 | class PreImportedModuleStartupActivity : StartupActivity { 8 | override fun runActivity(project: Project) { 9 | project.getService(PreImportedModuleService::class.java) 10 | } 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/notifications/MvNotifications.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.notifications 2 | 3 | import com.intellij.notification.NotificationGroup 4 | import com.intellij.notification.NotificationGroupManager 5 | 6 | object MvNotifications { 7 | fun buildLogGroup(): NotificationGroup { 8 | return NotificationGroupManager.getInstance().getNotificationGroup("Move Compile Log") 9 | } 10 | 11 | fun pluginNotifications(): NotificationGroup { 12 | return NotificationGroupManager.getInstance().getNotificationGroup("MOVE_ON_SUI") 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/presentation/PresentationInfo.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.presentation 2 | 3 | import org.sui.lang.core.psi.* 4 | import org.sui.lang.core.psi.ext.owner 5 | 6 | class PresentationInfo( 7 | val element: MvNamedElement, 8 | val type: String, 9 | val name: String 10 | ) 11 | 12 | val MvNamedElement.presentationInfo: PresentationInfo? 13 | get() { 14 | val elementName = name ?: return null 15 | 16 | val type = when (this) { 17 | is MvTypeParameter -> "type parameter" 18 | is MvPatBinding -> { 19 | val owner = this.owner 20 | when (owner) { 21 | is MvFunctionParameter -> "value parameter" 22 | is MvLetStmt -> "variable" 23 | else -> return null 24 | } 25 | } 26 | else -> return null 27 | } 28 | return PresentationInfo(this, type, elementName) 29 | } 30 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/refactoring/RefactoringSupportProvider.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.refactoring 2 | 3 | import com.intellij.lang.refactoring.RefactoringSupportProvider 4 | import com.intellij.psi.PsiElement 5 | import com.intellij.psi.PsiNameIdentifierOwner 6 | 7 | class MvRefactoringSupportProvider : RefactoringSupportProvider() { 8 | override fun isMemberInplaceRenameAvailable(element: PsiElement, context: PsiElement?): Boolean = 9 | element is PsiNameIdentifierOwner 10 | } 11 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/refactoring/toml/MvRenameAddressProcessor.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.refactoring.toml 2 | 3 | import com.intellij.psi.PsiElement 4 | import com.intellij.refactoring.rename.RenamePsiElementProcessor 5 | import org.sui.openapiext.addressesTable 6 | import org.toml.lang.psi.TomlKeySegment 7 | 8 | class MvRenameAddressProcessor : RenamePsiElementProcessor() { 9 | override fun canProcessElement(element: PsiElement): Boolean { 10 | return element is TomlKeySegment && element.addressesTable != null 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/refactoring/toml/TomlRenameHandler.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.refactoring.toml 2 | 3 | import com.intellij.openapi.actionSystem.CommonDataKeys 4 | import com.intellij.openapi.actionSystem.DataContext 5 | import com.intellij.refactoring.rename.PsiElementRenameHandler 6 | import org.sui.openapiext.addressesTable 7 | import org.toml.lang.psi.TomlKeySegment 8 | 9 | class TomlRenameHandler : PsiElementRenameHandler() { 10 | override fun isAvailableOnDataContext(dataContext: DataContext): Boolean { 11 | val element = getElement(dataContext) 12 | val editor = CommonDataKeys.EDITOR.getData(dataContext) 13 | val file = CommonDataKeys.PSI_FILE.getData(dataContext) 14 | if (editor == null || file == null) return false 15 | return element is TomlKeySegment && element.addressesTable != null 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/search/MvFindUsagesProvider.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.search 2 | 3 | import com.intellij.lang.HelpID 4 | import com.intellij.lang.findUsages.FindUsagesProvider 5 | import com.intellij.psi.PsiElement 6 | import org.sui.lang.core.psi.MvNamedElement 7 | 8 | class MvFindUsagesProvider : FindUsagesProvider { 9 | override fun getWordsScanner() = MvWordsScanner() 10 | 11 | override fun canFindUsagesFor(psiElement: PsiElement) = psiElement is MvNamedElement 12 | 13 | override fun getHelpId(element: PsiElement) = HelpID.FIND_OTHER_USAGES 14 | 15 | override fun getType(element: PsiElement) = "" 16 | override fun getDescriptiveName(element: PsiElement) = "" 17 | 18 | override fun getNodeText(element: PsiElement, useFullName: Boolean) = "" 19 | } 20 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/search/MvWordsScanner.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.search 2 | 3 | import com.intellij.lang.cacheBuilder.DefaultWordsScanner 4 | import org.sui.lang.MvElementTypes.BYTE_STRING_LITERAL 5 | import org.sui.lang.MvElementTypes.IDENTIFIER 6 | import org.sui.lang.core.MOVE_COMMENTS 7 | import org.sui.lang.core.lexer.createMoveLexer 8 | import org.sui.lang.core.tokenSetOf 9 | 10 | class MvWordsScanner : DefaultWordsScanner( 11 | createMoveLexer(), 12 | tokenSetOf(IDENTIFIER), 13 | MOVE_COMMENTS, 14 | tokenSetOf(BYTE_STRING_LITERAL) 15 | ) 16 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/search/NamedAddressFindUsagesHandlerFactory.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.search 2 | 3 | import com.intellij.find.findUsages.FindUsagesHandler 4 | import com.intellij.find.findUsages.FindUsagesHandlerFactory 5 | import com.intellij.psi.PsiElement 6 | import org.sui.lang.core.psi.ext.isNamedAddressDef 7 | import org.toml.lang.psi.TomlKeySegment 8 | 9 | class NamedAddressFindUsagesHandlerFactory : FindUsagesHandlerFactory() { 10 | override fun canFindUsages(element: PsiElement): Boolean { 11 | return (element as? TomlKeySegment)?.isNamedAddressDef() ?: false 12 | } 13 | 14 | override fun createFindUsagesHandler( 15 | element: PsiElement, 16 | forHighlightUsages: Boolean 17 | ): FindUsagesHandler { 18 | return object : FindUsagesHandler(element) {} 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/search/NamedAddressUsageTypeProvider.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.search 2 | 3 | import com.intellij.psi.PsiElement 4 | import com.intellij.usages.UsageTarget 5 | import com.intellij.usages.impl.rules.UsageType 6 | import com.intellij.usages.impl.rules.UsageTypeProviderEx 7 | import org.sui.lang.core.psi.MvNamedAddress 8 | 9 | class NamedAddressUsageTypeProvider : UsageTypeProviderEx { 10 | override fun getUsageType(element: PsiElement?, targets: Array): UsageType? { 11 | return when (element) { 12 | is MvNamedAddress -> ADDRESS_REF_USAGE_TYPE 13 | else -> null 14 | } 15 | } 16 | 17 | override fun getUsageType(element: PsiElement): UsageType? { 18 | return getUsageType(element, UsageTarget.EMPTY_ARRAY) 19 | } 20 | 21 | companion object { 22 | val ADDRESS_REF_USAGE_TYPE = UsageType { "address ref" } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/structureView/MvPsiStructureViewFactory.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.structureView 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.sui.lang.MoveFile 10 | 11 | class MvPsiStructureViewFactory : PsiStructureViewFactory { 12 | override fun getStructureViewBuilder(psiFile: PsiFile): StructureViewBuilder? { 13 | if (psiFile !is MoveFile) { 14 | return null 15 | } 16 | return object : TreeBasedStructureViewBuilder() { 17 | override fun createStructureViewModel(editor: Editor?): StructureViewModel { 18 | return MvStructureViewModel(editor, psiFile) 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/ide/utils/imports/ImportCandidate.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.utils.imports 2 | 3 | import org.sui.lang.core.psi.MvQualNamedElement 4 | import org.sui.lang.core.types.ItemQualName 5 | 6 | data class ImportCandidate(val element: MvQualNamedElement, val qualName: ItemQualName) 7 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/MoveFileType.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang 2 | 3 | import com.intellij.openapi.fileTypes.LanguageFileType 4 | import org.sui.ide.MoveIcons 5 | 6 | object MoveFileType : LanguageFileType(MoveLanguage) { 7 | override fun getIcon() = MoveIcons.SUI_LOGO 8 | override fun getName() = "Sui Move" 9 | override fun getDefaultExtension() = "move" 10 | override fun getDescription() = "Move Language file" 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/MoveLanguage.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang 2 | 3 | import com.intellij.lang.Language 4 | 5 | object MoveLanguage : Language("Sui Move") { 6 | override fun isCaseSensitive() = true 7 | override fun getDisplayName() = "Sui Move" 8 | } 9 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/MvElementType.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core 2 | 3 | import com.intellij.psi.tree.IElementType 4 | import org.sui.lang.MoveLanguage 5 | 6 | class MvElementType(debugName: String) : IElementType(debugName, MoveLanguage) 7 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/completion/MoveTextFieldCompletionContributor.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.completion 2 | 3 | import com.intellij.codeInsight.completion.CompletionParameters 4 | import com.intellij.codeInsight.completion.CompletionResultSet 5 | import com.intellij.util.textCompletion.TextCompletionContributor 6 | import org.sui.lang.core.psi.MvCodeFragment 7 | 8 | class MoveTextFieldCompletionContributor : TextCompletionContributor() { 9 | override fun fillCompletionVariants(parameters: CompletionParameters, result: CompletionResultSet) { 10 | if (parameters.originalFile is MvCodeFragment) { 11 | super.fillCompletionVariants(parameters, result) 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/completion/providers/BoolsCompletionProvider.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.completion.providers 2 | 3 | import com.intellij.codeInsight.completion.CompletionParameters 4 | import com.intellij.codeInsight.completion.CompletionProvider 5 | import com.intellij.codeInsight.completion.CompletionResultSet 6 | import com.intellij.codeInsight.lookup.LookupElementBuilder 7 | import com.intellij.patterns.ElementPattern 8 | import com.intellij.psi.PsiElement 9 | import com.intellij.util.ProcessingContext 10 | import org.sui.lang.core.MvPsiPattern 11 | 12 | object BoolsCompletionProvider : MvCompletionProvider() { 13 | 14 | override val elementPattern: ElementPattern get() = MvPsiPattern.simplePathPattern 15 | 16 | override fun addCompletions( 17 | parameters: CompletionParameters, 18 | context: ProcessingContext, 19 | result: CompletionResultSet 20 | ) { 21 | val lookups = 22 | listOf("true", "false").map { LookupElementBuilder.create(it).bold() } 23 | result.addAllElements(lookups) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/lexer/MoveLexer.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.lexer 2 | 3 | import com.intellij.lexer.FlexAdapter 4 | import org.sui.lang._MoveLexer 5 | 6 | fun createMoveLexer(): MoveLexer { 7 | return MoveLexer() 8 | } 9 | 10 | class MoveLexer : FlexAdapter(_MoveLexer(null)) 11 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/AnyBlock.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi 2 | 3 | import com.intellij.psi.PsiElement 4 | 5 | interface AnyBlock: MvElement { 6 | val stmtList: List get() = emptyList() 7 | val expr: MvExpr? get() = null 8 | val rBrace: PsiElement? get() = null 9 | } 10 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/InferenceCachedPathElement.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi 2 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/MvAcquireTypesOwner.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi 2 | 3 | interface MvAcquireTypesOwner : MvElement { 4 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/MvBoolSpecExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi 2 | 3 | interface MvBoolSpecExpr : MvExpr { 4 | val expr: MvExpr? 5 | } 6 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/MvLoopLike.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi 2 | 3 | interface MvLoopLike : MvElement { 4 | val codeBlock: MvCodeBlock? 5 | val inlineBlock: MvInlineBlock? 6 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/MvNameIdentifierOwner.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi 2 | 3 | import com.intellij.psi.PsiElement 4 | import com.intellij.psi.PsiNameIdentifierOwner 5 | 6 | interface MvNameIdentifierOwner : MvNamedElement, 7 | PsiNameIdentifierOwner 8 | 9 | 10 | interface MvMandatoryNameIdentifierOwner : MvMandatoryNamedElement, 11 | PsiNameIdentifierOwner { 12 | 13 | override fun getName(): String 14 | 15 | override fun getNameIdentifier(): PsiElement 16 | } 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/MvTypeAnnotationOwner.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi 2 | 3 | val MvTypeAnnotationOwner.type: MvType? get() = this.typeAnnotation?.type 4 | 5 | interface MvTypeAnnotationOwner : MvElement { 6 | 7 | val typeAnnotation: MvTypeAnnotation? 8 | } 9 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/PathExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi 2 | 3 | interface PathExpr : MvElement { 4 | val path: MvPath get() = error("unreachable") 5 | } 6 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ScopeMslOnlyElement.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi 2 | 3 | interface MslOnlyElement : MvElement 4 | 5 | interface ScopeMslOnlyElement : MslOnlyElement 6 | 7 | interface MvSpecOnlyExpr : MslOnlyElement 8 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvAbility.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvAbility 4 | import org.sui.lang.core.types.ty.Ability 5 | 6 | val MvAbility.ability: Ability? 7 | get() = 8 | when (this.text) { 9 | "copy" -> Ability.COPY 10 | "store" -> Ability.STORE 11 | "key" -> Ability.KEY 12 | "drop" -> Ability.DROP 13 | else -> null 14 | } 15 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvAddressDef.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.ide.projectView.PresentationData 4 | import com.intellij.lang.ASTNode 5 | import com.intellij.navigation.ItemPresentation 6 | import org.sui.lang.core.psi.MvAddressDef 7 | import org.sui.lang.core.psi.MvElementImpl 8 | import org.sui.lang.core.psi.MvModule 9 | import org.sui.lang.core.types.address 10 | import org.sui.lang.moveProject 11 | 12 | fun MvAddressDef.modules(): List = 13 | addressBlock?.childrenOfType().orEmpty() 14 | 15 | 16 | abstract class MvAddressDefMixin(node: ASTNode) : MvElementImpl(node), 17 | MvAddressDef { 18 | override fun getPresentation(): ItemPresentation? { 19 | val addressText = this.addressRef?.address(this.moveProject)?.text() ?: "" 20 | return PresentationData( 21 | addressText, 22 | this.locationString(true), 23 | null, 24 | null 25 | ) 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvAddressRef.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvAddressRef 4 | 5 | val MvAddressRef.normalizedText: String get() = this.text.lowercase() 6 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvAssertBangExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.psi.PsiElement 4 | import org.sui.lang.MvElementTypes.IDENTIFIER 5 | import org.sui.lang.core.psi.MvAssertMacroExpr 6 | 7 | val MvAssertMacroExpr.identifier: PsiElement get() = this.findFirstChildByType(IDENTIFIER)!! -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvAttr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvAttr 4 | 5 | val MvAttr.owner: MvDocAndAttributeOwner? 6 | get() = this.parent as? MvDocAndAttributeOwner 7 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvBinaryExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.sui.lang.MvElementTypes.BINARY_OP 5 | import org.sui.lang.core.psi.MvBinaryExpr 6 | import org.sui.lang.core.psi.MvElementImpl 7 | 8 | abstract class MvBinaryExprMixin(node: ASTNode): MvElementImpl(node), 9 | MvBinaryExpr { 10 | override fun toString(): String { 11 | val op = node.findChildByType(BINARY_OP)?.text ?: "" 12 | return "${javaClass.simpleName}(${node.elementType}[$op])" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvBinaryOp.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.psi.PsiElement 4 | import org.sui.lang.core.MOVE_BINARY_OPS 5 | import org.sui.lang.core.psi.MvBinaryOp 6 | 7 | val MvBinaryOp.operator: PsiElement 8 | get() = requireNotNull(node.findChildByType(MOVE_BINARY_OPS)) { "guaranteed to be not-null by parser" }.psi 9 | 10 | val MvBinaryOp.op: String get() = operator.text 11 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvBorrowExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.MvElementTypes 4 | import org.sui.lang.core.psi.MvBorrowExpr 5 | 6 | val MvBorrowExpr.isMut: Boolean get() = hasChild(MvElementTypes.MUT) 7 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvCallExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvCallExpr 4 | import org.sui.lang.core.psi.MvElement 5 | import org.sui.lang.core.psi.MvExpr 6 | import org.sui.lang.core.psi.MvPath 7 | import org.sui.lang.core.psi.MvValueArgument 8 | import org.sui.lang.core.psi.MvValueArgumentList 9 | 10 | interface MvCallable: MvElement { 11 | val valueArgumentList: MvValueArgumentList? 12 | } 13 | 14 | val MvCallable.valueArguments: List 15 | get() = 16 | this.valueArgumentList?.valueArgumentList.orEmpty() 17 | 18 | val MvCallable.argumentExprs: List get() = this.valueArguments.map { it.expr } 19 | 20 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvCodeBlock.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.sui.lang.MvElementTypes.R_BRACE 6 | import org.sui.lang.core.psi.MvCodeBlock 7 | import org.sui.lang.core.psi.MvElementImpl 8 | import org.sui.lang.core.psi.MvExpr 9 | import org.sui.lang.core.psi.MvLetStmt 10 | 11 | val MvCodeBlock.returningExpr: MvExpr? get() = this.expr 12 | 13 | val MvCodeBlock.rightBrace: PsiElement? get() = this.findLastChildByType(R_BRACE) 14 | 15 | val MvCodeBlock.letStmts: List get() = stmtList.filterIsInstance() 16 | 17 | abstract class MvCodeBlockMixin(node: ASTNode) : MvElementImpl(node), MvCodeBlock { 18 | 19 | // override val useStmts: List get() = useStmtList 20 | } 21 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvEnumVariant.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.stubs.IStubElementType 5 | import org.sui.ide.MoveIcons 6 | import org.sui.lang.core.psi.MvEnum 7 | import org.sui.lang.core.psi.MvEnumBody 8 | import org.sui.lang.core.psi.MvEnumVariant 9 | import org.sui.lang.core.stubs.MvEnumVariantStub 10 | import org.sui.lang.core.stubs.MvStubbedNamedElementImpl 11 | import javax.swing.Icon 12 | 13 | val MvEnumVariant.enumBody: MvEnumBody get() = this.parent as MvEnumBody 14 | val MvEnumVariant.enumItem: MvEnum get() = this.enumBody.parent as MvEnum 15 | 16 | abstract class MvEnumVariantMixin: MvStubbedNamedElementImpl, 17 | MvEnumVariant { 18 | constructor(node: ASTNode): super(node) 19 | 20 | constructor(stub: MvEnumVariantStub, nodeType: IStubElementType<*, *>): super(stub, nodeType) 21 | 22 | override fun getIcon(flags: Int): Icon = MoveIcons.STRUCT 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.* 4 | import org.sui.lang.core.resolve2.ref.InferenceCachedPathElement 5 | 6 | val MvExpr.isAtomExpr: Boolean get() = 7 | this is MvAnnotatedExpr 8 | || this is MvTupleLitExpr 9 | || this is MvParensExpr 10 | || this is MvVectorLitExpr 11 | || this is MvDotExpr 12 | || this is MvIndexExpr 13 | || this is MvCallExpr 14 | || this is MvPathExpr 15 | || this is MvLambdaExpr 16 | || this is MvLitExpr 17 | || this is MvCodeBlockExpr 18 | 19 | val MvIndexExpr.receiverExpr: MvExpr get() = exprList.first() 20 | 21 | val MvIndexExpr.argExpr: MvExpr get() = exprList.drop(1).first() 22 | 23 | val MvExpr.declaration: MvElement? 24 | get() = when (this) { 25 | is InferenceCachedPathElement -> path.reference?.resolve() 26 | is MvDotExpr -> expr.declaration 27 | is MvIndexExpr -> receiverExpr.declaration 28 | else -> null 29 | } 30 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvFQModuleRef.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | //abstract class MvFQModuleRefMixin(node: ASTNode) : MvElementImpl(node), 4 | // MvFQModuleRef { 5 | // override val identifier: PsiElement? 6 | // get() = findChildByType(MvElementTypes.IDENTIFIER) 7 | // 8 | // override fun getReference(): MvFQModuleReference { 9 | // return MvFQModuleReferenceImpl(this) 10 | // } 11 | // 12 | // override fun getMul(): PsiElement? = null 13 | //} 14 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvFunctionParameterList.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvFunctionParameter 4 | import org.sui.utils.SignatureUtils 5 | 6 | fun List.joinToSignature(): String { 7 | val parameterPairs = this.map { Pair(it.patBinding.name, it.typeAnnotation?.type?.text) } 8 | return SignatureUtils.joinParameters(parameterPairs) 9 | } 10 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvGlobalVariable.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.sui.ide.MoveIcons 5 | import org.sui.lang.core.psi.MvGlobalVariableStmt 6 | import org.sui.lang.core.psi.impl.MvNameIdentifierOwnerImpl 7 | import javax.swing.Icon 8 | 9 | abstract class MvGlobalVariableMixin(node: ASTNode): MvNameIdentifierOwnerImpl(node), 10 | MvGlobalVariableStmt { 11 | 12 | override fun getIcon(flags: Int): Icon? = MoveIcons.BINDING 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvIfExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvElseBlock 4 | import org.sui.lang.core.psi.MvExpr 5 | import org.sui.lang.core.psi.MvIfExpr 6 | 7 | val MvIfExpr.tailExpr: MvExpr? 8 | get() { 9 | val codeBlock = this.codeBlock 10 | if (codeBlock != null) return codeBlock.returningExpr 11 | return this.inlineBlock?.expr 12 | } 13 | 14 | val MvElseBlock.tailExpr: MvExpr? 15 | get() { 16 | val elseCodeBlock = this.codeBlock 17 | if (elseCodeBlock != null) return elseCodeBlock.returningExpr 18 | return this.inlineBlock?.expr 19 | } 20 | 21 | val MvIfExpr.elseTailExpr: MvExpr? 22 | get() { 23 | val elseBlock = this.elseBlock ?: return null 24 | val elseCodeBlock = elseBlock.codeBlock 25 | if (elseCodeBlock != null) return elseCodeBlock.returningExpr 26 | return elseBlock.inlineBlock?.expr 27 | } 28 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvItemElement.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvNameIdentifierOwner 4 | 5 | interface MvItemElement: MvVisibilityOwner, MvDocAndAttributeOwner, MvNameIdentifierOwner -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvItemSpecRef.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.sui.lang.core.psi.MvElementImpl 5 | import org.sui.lang.core.psi.MvItemSpec 6 | import org.sui.lang.core.psi.MvItemSpecRef 7 | import org.sui.lang.core.resolve.ref.MvItemSpecRefReferenceImpl 8 | import org.sui.lang.core.resolve.ref.MvPolyVariantReference 9 | 10 | val MvItemSpecRef.itemSpec: MvItemSpec get() = this.parent as MvItemSpec 11 | 12 | abstract class MvItemSpecRefMixin(node: ASTNode) : MvElementImpl(node), MvItemSpecRef { 13 | 14 | override fun getReference(): MvPolyVariantReference = MvItemSpecRefReferenceImpl(this) 15 | } 16 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvLambda.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvLambdaType 4 | import org.sui.lang.core.psi.MvType 5 | 6 | val MvLambdaType.paramTypes: List 7 | get() = this.lambdaTypeParamList.map { it.type } 8 | 9 | val MvLambdaType.returnType: MvType? get() = this.type 10 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvLetStatement.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.MvElementTypes.POST 4 | import org.sui.lang.core.psi.MvLetStmt 5 | 6 | val MvLetStmt.post: Boolean get() = this.hasChild(POST) 7 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvMatchArm.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvMatchArm 4 | import org.sui.lang.core.psi.MvMatchBody 5 | import org.sui.lang.core.psi.MvMatchExpr 6 | 7 | val MvMatchArm.matchBody: MvMatchBody get() = this.parent as MvMatchBody 8 | val MvMatchArm.matchExpr: MvMatchExpr get() = this.matchBody.parent as MvMatchExpr 9 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvMatchExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvMatchArgument 4 | import org.sui.lang.core.psi.MvMatchArm 5 | import org.sui.lang.core.psi.MvMatchBody 6 | import org.sui.lang.core.psi.MvMatchExpr 7 | 8 | val MvMatchExpr.matchArgument: MvMatchArgument get() = childOfType()!! 9 | val MvMatchExpr.matchBody: MvMatchBody get() = childOfType()!! 10 | val MvMatchExpr.arms: List get() = matchBody.matchArmList 11 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvMethodOrPath.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvTypeArgument 4 | import org.sui.lang.core.psi.MvTypeArgumentList 5 | import org.sui.lang.core.resolve.ref.MvReferenceElement 6 | 7 | val MvMethodOrPath.typeArguments: List get() = typeArgumentList?.typeArgumentList.orEmpty() 8 | 9 | interface MvMethodOrPath : MvReferenceElement { 10 | val typeArgumentList: MvTypeArgumentList? 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvModuleSpec.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.stubs.IStubElementType 5 | import org.sui.lang.core.psi.MvModuleSpec 6 | import org.sui.lang.core.stubs.MvModuleSpecStub 7 | import org.sui.lang.core.stubs.MvStubbedElementImpl 8 | 9 | abstract class MvModuleSpecMixin : MvStubbedElementImpl, MvModuleSpec { 10 | 11 | constructor(node: ASTNode) : super(node) 12 | 13 | constructor(stub: MvModuleSpecStub, nodeType: IStubElementType<*, *>) : super(stub, nodeType) 14 | } 15 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvPat.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.psi.util.descendantsOfType 4 | import org.sui.lang.core.psi.MvPatBinding 5 | import org.sui.lang.core.psi.MvNamedElement 6 | import org.sui.lang.core.psi.MvPat 7 | import org.sui.lang.core.psi.MvPatIdent 8 | 9 | val MvPat.bindings: List get() = this.descendantsOfType().toList() 10 | 11 | val MvPatIdent.patBinding: MvPatBinding get() = childOfType()!! 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvQuantExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.* 4 | 5 | interface MvQuantBindingsOwner: MvElement { 6 | val quantBindings: MvQuantBindings? 7 | } 8 | 9 | interface MvQuantExpr : MvQuantBindingsOwner { 10 | val expr: MvExpr? 11 | val quantWhere: MvQuantWhere? 12 | } 13 | 14 | val MvQuantBindingsOwner.bindings: List 15 | get() = quantBindings?.quantBindingList.orEmpty().mapNotNull { it.binding } 16 | 17 | val MvQuantBinding.binding: MvPatBinding 18 | get() = when (this) { 19 | is MvTypeQuantBinding -> this.patBinding 20 | is MvRangeQuantBinding -> this.patBinding 21 | else -> error("unreachable") 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvRefExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvAttr 4 | import org.sui.lang.core.psi.MvAttrItem 5 | import org.sui.lang.core.psi.MvFunction 6 | import org.sui.lang.core.psi.MvPathExpr 7 | 8 | fun MvPathExpr.isAbortCodeConst(): Boolean { 9 | val abortCodeItem = 10 | (this.parent.parent as? MvAttrItem) 11 | ?.takeIf { it.isAbortCode } 12 | ?: return false 13 | val attr = abortCodeItem.ancestorStrict() ?: return false 14 | return (attr.owner as? MvFunction)?.hasTestAttr ?: false 15 | } 16 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvRefType.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvRefType 4 | 5 | val MvRefType.mutable: Boolean 6 | get() = 7 | "mut" in this.refTypeStart.text 8 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvSchemaLit.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvSchema 4 | import org.sui.lang.core.psi.MvSchemaLit 5 | import org.sui.lang.core.psi.MvSchemaLitField 6 | 7 | val MvSchemaLit.schema: MvSchema? get() = this.path.reference?.resolveFollowingAliases() as? MvSchema 8 | 9 | val MvSchemaLit.fields: List get() = schemaFieldsBlock?.schemaLitFieldList.orEmpty() 10 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvSpecBlock.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.* 4 | 5 | fun MvSpecCodeBlock.schemaFields(): List = childrenOfType() 6 | 7 | fun MvSpecCodeBlock.globalVariables(): List = childrenOfType() 8 | 9 | val MvSpecCodeBlock.allLetStmts: List get() = this.childrenOfType() 10 | 11 | fun MvSpecCodeBlock.letStmts(post: Boolean): List { 12 | val letStmts = this.allLetStmts 13 | return if (post) { 14 | letStmts.filter { it.post } 15 | } else { 16 | letStmts.filter { !it.post } 17 | } 18 | } 19 | 20 | fun MvSpecCodeBlock.specInlineFunctions(): List { 21 | return this.childrenOfType() 22 | .map { it.specInlineFunction } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvStructLitExpr.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvStructLitExpr 4 | import org.sui.lang.core.psi.MvStructLitField 5 | import org.sui.lang.core.psi.MvStructLitFieldsBlock 6 | 7 | val MvStructLitExpr.fields: List get() = structLitFieldsBlock.structLitFieldList 8 | 9 | val MvStructLitExpr.providedFieldNames: Set get() = fields.map { it.referenceName }.toSet() 10 | 11 | val MvStructLitFieldsBlock.litExpr: MvStructLitExpr get() = this.parent as MvStructLitExpr 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvStructPat.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvPatStruct 4 | import org.sui.lang.core.psi.MvStruct 5 | 6 | val MvPatStruct.providedFieldNames: Set 7 | get() = 8 | patFieldList.map { it.fieldReferenceName }.toSet() 9 | 10 | //val MvPatStruct.structItem: MvStruct? get() = this.path.reference?.resolveFollowingAliases() as? MvStruct 11 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvType.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvPathType 4 | import org.sui.lang.core.psi.MvRefType 5 | import org.sui.lang.core.psi.MvType 6 | import org.sui.lang.core.psi.MvTypeArgument 7 | import org.sui.lang.core.resolve.ref.MvPolyVariantReference 8 | 9 | val MvType.moveReference: MvPolyVariantReference? 10 | get() = when (this) { 11 | is MvPathType -> this.path.reference 12 | is MvRefType -> this.type?.moveReference 13 | else -> null 14 | } 15 | val MvType.typeArguments: List 16 | get() { 17 | return when (this) { 18 | is MvPathType -> this.path.typeArguments 19 | is MvRefType -> this.type?.typeArguments.orEmpty() 20 | else -> emptyList() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvTypeParameter.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.sui.lang.MvElementTypes 5 | import org.sui.lang.core.psi.MvAbility 6 | import org.sui.lang.core.psi.MvTypeParameter 7 | import org.sui.lang.core.psi.impl.MvNameIdentifierOwnerImpl 8 | import org.sui.lang.core.types.ty.TyTypeParameter 9 | 10 | val MvTypeParameter.isPhantom get() = hasChild(MvElementTypes.PHANTOM) 11 | 12 | val MvTypeParameter.typeParamType: TyTypeParameter 13 | get() { 14 | return TyTypeParameter(this) 15 | } 16 | 17 | val MvTypeParameter.abilityBounds: List 18 | get() { 19 | return typeParamBound?.abilityList.orEmpty() 20 | } 21 | 22 | //fun MvTypeParameter.ty(): TyTypeParameter = TyTypeParameter(this) 23 | 24 | abstract class MvTypeParameterMixin(node: ASTNode) : MvNameIdentifierOwnerImpl(node), 25 | MvTypeParameter 26 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvUseAlias.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.sui.lang.core.psi.MvUseAlias 5 | import org.sui.lang.core.psi.MvUseSpeck 6 | import org.sui.lang.core.psi.impl.MvNameIdentifierOwnerImpl 7 | 8 | val MvUseAlias.parentUseSpeck: MvUseSpeck get() = this.parent as MvUseSpeck 9 | 10 | abstract class MvUseAliasMixin(node: ASTNode) : MvNameIdentifierOwnerImpl(node), 11 | MvUseAlias 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvUseGroup.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import com.intellij.psi.PsiComment 4 | import com.intellij.psi.SyntaxTraverser 5 | import org.sui.lang.core.psi.MvUseGroup 6 | import org.sui.lang.core.psi.MvUseSpeck 7 | 8 | val MvUseGroup.parentUseSpeck: MvUseSpeck get() = parent as MvUseSpeck 9 | 10 | val MvUseGroup.names get() = this.useSpeckList.mapNotNull { it.path.identifier?.text } 11 | 12 | val MvUseGroup.asTrivial: MvUseSpeck? 13 | get() { 14 | val speck = useSpeckList.singleOrNull() ?: return null 15 | // Do not change use-groups with comments 16 | if (SyntaxTraverser.psiTraverser(this).traverse().any { it is PsiComment }) return null 17 | return speck 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvUseSpeck.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.core.psi.MvPath 4 | import org.sui.lang.core.psi.MvUseGroup 5 | import org.sui.lang.core.psi.MvUseSpeck 6 | 7 | val MvUseSpeck.qualifier: MvPath? get() { 8 | val parentUseSpeck = (context as? MvUseGroup)?.parentUseSpeck ?: return null 9 | return parentUseSpeck.path 10 | } 11 | val MvUseSpeck.isSelf: Boolean get() = this.path.identifier?.textMatches("Self") ?: false 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/ext/MvVisibilityModifier.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.ext 2 | 3 | import org.sui.lang.MvElementTypes.* 4 | import org.sui.lang.core.psi.MvFunction 5 | import org.sui.lang.core.psi.MvVisibilityModifier 6 | 7 | val MvVisibilityModifier.hasPublic get() = hasChild(PUBLIC) 8 | val MvVisibilityModifier.hasScript get() = hasChild(SCRIPT) 9 | val MvVisibilityModifier.hasPackage get() = hasChild(PACKAGE) 10 | val MvVisibilityModifier.hasFriend get() = hasChild(FRIEND) 11 | 12 | val MvVisibilityModifier.function: MvFunction? get() = parent as? MvFunction -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/psi/impl/MvNameIdentifierOwnerImpl.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.psi.impl 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.PsiElement 5 | import org.sui.lang.core.psi.MvMandatoryNameIdentifierOwner 6 | import org.sui.lang.core.psi.MvNameIdentifierOwner 7 | 8 | abstract class MvNameIdentifierOwnerImpl(node: ASTNode) : MvNamedElementImpl(node), 9 | MvNameIdentifierOwner { 10 | override fun getNameIdentifier(): PsiElement? = nameElement 11 | } 12 | 13 | abstract class MvMandatoryNameIdentifierOwnerImpl(node: ASTNode) : MvMandatoryNamedElementImpl(node), 14 | MvMandatoryNameIdentifierOwner { 15 | 16 | override fun getNameIdentifier(): PsiElement = nameElement 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/resolve/LetStmtScope.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.resolve 2 | 3 | import org.sui.lang.core.psi.MvElement 4 | import org.sui.lang.core.psi.MvLetStmt 5 | import org.sui.lang.core.psi.ext.ancestorOrSelf 6 | import org.sui.lang.core.psi.ext.isMsl 7 | import org.sui.lang.core.psi.ext.post 8 | 9 | enum class LetStmtScope { 10 | NOT_MSL, EXPR_STMT, LET_STMT, LET_POST_STMT; 11 | } 12 | 13 | val MvElement.letStmtScope: LetStmtScope 14 | get() { 15 | if (!this.isMsl()) return LetStmtScope.NOT_MSL 16 | val letStmt = this.ancestorOrSelf() 17 | return when { 18 | letStmt == null -> LetStmtScope.EXPR_STMT 19 | letStmt.post -> LetStmtScope.LET_POST_STMT 20 | else -> LetStmtScope.LET_STMT 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/resolve/ref/MvItemSpecRefReferenceImpl.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.resolve.ref 2 | 3 | import org.sui.lang.core.psi.MvItemSpecRef 4 | import org.sui.lang.core.psi.MvNamedElement 5 | import org.sui.lang.core.psi.ext.itemSpec 6 | import org.sui.lang.core.psi.ext.module 7 | import org.sui.lang.core.psi.ext.mslSpecifiableItems 8 | 9 | class MvItemSpecRefReferenceImpl(element: MvItemSpecRef) : MvPolyVariantReferenceCached(element) { 10 | 11 | override fun multiResolveInner(): List { 12 | val module = element.itemSpec.module ?: return emptyList() 13 | val referenceName = element.referenceName 14 | return module.mslSpecifiableItems 15 | .filter { it.name == referenceName } 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/resolve2/ref/MvStructLitFieldReferenceImpl.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.resolve2.ref 2 | 3 | import org.sui.lang.core.psi.MvNamedElement 4 | import org.sui.lang.core.psi.MvStructLitField 5 | import org.sui.lang.core.resolve.collectResolveVariants 6 | import org.sui.lang.core.resolve.ref.MvPolyVariantReferenceCached 7 | import org.sui.lang.core.resolve.ref.ResolveCacheDependency 8 | import org.sui.lang.core.resolve2.processStructLitFieldResolveVariants 9 | 10 | class MvStructLitFieldReferenceImpl( 11 | field: MvStructLitField 12 | ) : MvPolyVariantReferenceCached(field) { 13 | 14 | override val cacheDependency: ResolveCacheDependency get() = ResolveCacheDependency.LOCAL_AND_RUST_STRUCTURE 15 | 16 | override fun multiResolveInner(): List = 17 | collectResolveVariants(element.referenceName) { 18 | processStructLitFieldResolveVariants(element, false, it) 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/resolve2/ref/RsPathResolveResult.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.resolve2.ref 2 | 3 | import com.intellij.psi.PsiElement 4 | import com.intellij.psi.ResolveResult 5 | import org.sui.lang.core.psi.MvElement 6 | 7 | /** 8 | * Used as a resolve result in [org.rust.lang.core.resolve.ref.RsPathReferenceImpl] 9 | */ 10 | data class RsPathResolveResult( 11 | val element: T, 12 | // val resolvedSubst: Substitution = emptySubstitution, 13 | val isVisible: Boolean, 14 | // val namespaces: Set = emptySet(), 15 | ) : ResolveResult { 16 | override fun getElement(): PsiElement = element 17 | 18 | override fun isValidResult(): Boolean = true 19 | } 20 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/stubs/MoveStubElementType.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.stubs 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.stubs.IStubElementType 5 | import com.intellij.psi.stubs.IndexSink 6 | import com.intellij.psi.stubs.StubElement 7 | import com.intellij.psi.tree.IStubFileElementType 8 | import org.sui.lang.MoveLanguage 9 | import org.sui.lang.core.psi.MvElement 10 | 11 | abstract class MvStubElementType, PsiT : MvElement>( 12 | debugName: String, 13 | ) : IStubElementType(debugName, MoveLanguage) { 14 | 15 | final override fun getExternalId(): String = "move.${super.toString()}" 16 | 17 | override fun indexStub(stub: StubT, sink: IndexSink) {} 18 | } 19 | 20 | fun createStubIfParentIsStub(node: ASTNode): Boolean { 21 | val parent = node.treeParent 22 | val parentType = parent.elementType 23 | return (parentType is IStubElementType<*, *> && parentType.shouldCreateStub(parent)) || 24 | parentType is IStubFileElementType<*> 25 | } 26 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/stubs/ext/StubElement.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.stubs.ext 2 | 3 | import com.intellij.psi.stubs.StubElement 4 | 5 | inline fun > StubElement<*>.childrenStubsOfType(): List = 6 | childrenStubs.filterIsInstance() 7 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/stubs/impl/MoveAddressDefStub.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.stubs.impl 2 | 3 | //class MvAddressDefStub( 4 | // parent: StubElement<*>?, 5 | // elementType: IStubElementType<*, *>, 6 | //) : StubBase(parent, elementType) { 7 | // 8 | // object Type : MvStubElementType("ADDRESS_DEF") { 9 | // 10 | // override fun deserialize(dataStream: StubInputStream, parentStub: StubElement<*>?) = 11 | // MvAddressDefStub( 12 | // parentStub, this, 13 | // ) 14 | // 15 | // override fun serialize(stub: MvAddressDefStub, dataStream: StubOutputStream) {} 16 | // 17 | // override fun createPsi(stub: MvAddressDefStub): MvAddressDef = 18 | // MvAddressDefImpl(stub, this) 19 | // 20 | // override fun createStub(psi: MvAddressDef, parentStub: StubElement<*>?) = 21 | // MvAddressDefStub(parentStub, this) 22 | // 23 | // override fun indexStub(stub: MvAddressDefStub, sink: IndexSink) = sink.indexNamedStub() 24 | // } 25 | //} 26 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/types/infer/RsPsiSubstitution.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.types.infer 2 | 3 | import org.sui.lang.core.psi.MvType 4 | import org.sui.lang.core.psi.MvTypeParameter 5 | 6 | /** Similar to [Substitution], but maps PSI to PSI instead of [Ty] to [Ty] */ 7 | class RsPsiSubstitution( 8 | val typeSubst: Map> = emptyMap(), 9 | ) { 10 | sealed class Value { 11 | object RequiredAbsent : Value() 12 | object OptionalAbsent : Value() 13 | class Present

(val value: P) : Value

() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/types/ty/TyInfer.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.types.ty 2 | 3 | import org.sui.ide.presentation.tyToString 4 | import org.sui.lang.core.types.infer.HAS_TY_INFER_MASK 5 | import org.sui.lang.core.types.infer.Node 6 | import org.sui.lang.core.types.infer.NodeOrValue 7 | import org.sui.lang.core.types.infer.VarValue 8 | 9 | sealed class TyInfer : Ty(HAS_TY_INFER_MASK) { 10 | // Note these classes must NOT be `data` classes and must provide equality by identity 11 | class TyVar( 12 | val origin: TyTypeParameter? = null, 13 | override var parent: NodeOrValue = VarValue(null, 0) 14 | ) : TyInfer(), Node { 15 | 16 | override fun abilities(): Set = origin?.abilities() ?: Ability.none() 17 | } 18 | 19 | class IntVar( 20 | override var parent: NodeOrValue = VarValue(null, 0) 21 | ) : TyInfer(), Node { 22 | 23 | override fun abilities(): Set = Ability.all() 24 | } 25 | 26 | override fun toString(): String = tyToString(this) 27 | } 28 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/types/ty/TyRange.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.types.ty 2 | 3 | import org.sui.ide.presentation.tyToString 4 | 5 | data class TyRange(val item: Ty) : Ty() { 6 | override fun abilities(): Set = Ability.all() 7 | override fun toString(): String = tyToString(this) 8 | } 9 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/types/ty/TySchema.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.core.types.ty 2 | 3 | import org.sui.lang.core.psi.MvSchema 4 | import org.sui.lang.core.types.infer.Substitution 5 | import org.sui.lang.core.types.infer.TypeFolder 6 | import org.sui.lang.core.types.infer.mergeFlags 7 | 8 | data class TySchema( 9 | override val item: MvSchema, 10 | override val substitution: Substitution, 11 | val typeArguments: List 12 | ) : GenericTy(item, substitution, mergeFlags(typeArguments)) { 13 | 14 | override fun abilities(): Set = Ability.all() 15 | 16 | override fun innerFoldWith(folder: TypeFolder): Ty { 17 | return TySchema( 18 | item, 19 | substitution.foldValues(folder), 20 | typeArguments.map { it.foldWith(folder) } 21 | ) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/types/ty/TyTuple.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Use of this source code is governed by the MIT license that can be 3 | * found in the LICENSE file. 4 | */ 5 | 6 | package org.sui.lang.core.types.ty 7 | 8 | import org.sui.ide.presentation.tyToString 9 | 10 | import org.sui.lang.core.types.infer.TypeFolder 11 | import org.sui.lang.core.types.infer.TypeVisitor 12 | import org.sui.lang.core.types.infer.mergeFlags 13 | 14 | data class TyTuple(val types: List) : Ty(mergeFlags(types)) { 15 | override fun abilities() = Ability.all() 16 | 17 | override fun innerFoldWith(folder: TypeFolder): Ty = 18 | TyTuple(types.map { it.foldWith(folder) }) 19 | 20 | override fun innerVisitWith(visitor: TypeVisitor): Boolean = 21 | types.any(visitor) 22 | 23 | override fun toString(): String = tyToString(this) 24 | 25 | companion object { 26 | fun unknown(arity: Int): TyTuple = TyTuple(generateSequence { TyUnknown }.take(arity).toList()) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/lang/core/types/ty/TyUnknown.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Use of this source code is governed by the MIT license that can be 3 | * found in the LICENSE file. 4 | */ 5 | 6 | package org.sui.lang.core.types.ty 7 | 8 | import org.sui.ide.presentation.tyToString 9 | import org.sui.lang.core.types.infer.HAS_TY_UNKNOWN_MASK 10 | 11 | object TyUnknown : Ty(HAS_TY_UNKNOWN_MASK) { 12 | override fun abilities() = Ability.all() 13 | override fun toString(): String = tyToString(this) 14 | } 15 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/openapiext/Component.kt: -------------------------------------------------------------------------------- 1 | package org.sui.openapiext 2 | 3 | import com.intellij.ide.DataManager 4 | import com.intellij.openapi.actionSystem.CommonDataKeys 5 | import com.intellij.openapi.project.Project 6 | import java.awt.Component 7 | 8 | val Component.project: Project? get() { 9 | val context = DataManager.getInstance().getDataContext(this) 10 | return CommonDataKeys.PROJECT.getData(context) 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/openapiext/Editor.kt: -------------------------------------------------------------------------------- 1 | package org.sui.openapiext 2 | 3 | import com.intellij.openapi.editor.Editor 4 | import com.intellij.openapi.editor.ex.EditorEx 5 | import com.intellij.openapi.editor.highlighter.HighlighterIterator 6 | 7 | 8 | fun isValidOffset(offset: Int, text: CharSequence): Boolean = 9 | 0 <= offset && offset <= text.length 10 | 11 | 12 | fun Editor.createLexer(offset: Int): HighlighterIterator? { 13 | if (!isValidOffset(offset, document.charsSequence)) return null 14 | val lexer = (this as EditorEx).highlighter.createIterator(offset) 15 | if (lexer.atEnd()) return null 16 | return lexer 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/openapiext/Logger.kt: -------------------------------------------------------------------------------- 1 | package org.sui.openapiext 2 | 3 | import com.intellij.openapi.diagnostic.LogLevel 4 | import com.intellij.openapi.diagnostic.LogLevel.* 5 | import com.intellij.openapi.diagnostic.Logger 6 | import org.sui.openapiext.common.isUnitTestMode 7 | 8 | fun Logger.debugInProduction(message: String) { 9 | if (isUnitTestMode) { 10 | this.warn(message) 11 | } else { 12 | this.debug(message) 13 | } 14 | } 15 | 16 | fun Logger.log(content: String, level: LogLevel) { 17 | when (level) { 18 | ERROR -> this.error(content) 19 | WARNING -> this.warn(content) 20 | INFO -> this.info(content) 21 | DEBUG -> this.debug(content) 22 | TRACE -> this.trace(content) 23 | OFF, ALL -> {} 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/openapiext/PluginPathManager.kt: -------------------------------------------------------------------------------- 1 | package org.sui.openapiext 2 | 3 | import com.intellij.openapi.util.SystemInfo 4 | import java.nio.file.Path 5 | 6 | object PluginPathManager { 7 | private fun pluginDir(): Path = plugin().pluginPath 8 | 9 | fun getCurrentOS(): String { 10 | return when { 11 | SystemInfo.isMac -> "macos" 12 | SystemInfo.isWindows -> "windows" 13 | SystemInfo.isLinux -> "ubuntu" 14 | else -> "ubuntu" 15 | } 16 | } 17 | 18 | val bundledSuiCli: String? 19 | get() { 20 | return null 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/openapiext/TaskResult.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Use of this source code is governed by the MIT license that can be 3 | * found in the LICENSE file. 4 | */ 5 | 6 | package org.sui.openapiext 7 | 8 | sealed class TaskResult { 9 | class Ok(val value: T) : TaskResult() 10 | class Err(val reason: String, val message: String? = null) : TaskResult() 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/openapiext/paths.kt: -------------------------------------------------------------------------------- 1 | package org.sui.openapiext 2 | 3 | import com.intellij.openapi.vfs.VirtualFile 4 | import com.intellij.openapi.vfs.VirtualFileManager 5 | import org.sui.stdext.exists 6 | import java.nio.file.Path 7 | import java.nio.file.Paths 8 | 9 | fun Path.resolveExisting(other: String): Path? { 10 | val path = resolve(other) 11 | return if (path.exists()) path else null 12 | } 13 | 14 | fun Path.resolveAbsPath(other: String): Path? { 15 | val rawPath = Paths.get(other) 16 | if (rawPath.isAbsolute && rawPath.exists()) return rawPath 17 | 18 | val joined = this.resolve(other) 19 | if (!joined.exists()) { 20 | return null 21 | } else { 22 | return joined.toRealPath() 23 | } 24 | } 25 | 26 | fun Path.toVirtualFile(): VirtualFile? = 27 | VirtualFileManager.getInstance().findFileByNioPath(this) 28 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/toml/MoveTomlLocalPathReferenceProvider.kt: -------------------------------------------------------------------------------- 1 | package org.sui.toml 2 | 3 | import com.intellij.psi.PsiElement 4 | import com.intellij.psi.PsiReferenceProvider 5 | import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference 6 | import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet 7 | import com.intellij.util.ProcessingContext 8 | import org.toml.lang.psi.TomlLiteral 9 | import org.toml.lang.psi.ext.TomlLiteralKind 10 | import org.toml.lang.psi.ext.kind 11 | 12 | class MoveTomlLocalPathReferenceProvider : PsiReferenceProvider() { 13 | override fun getReferencesByElement( 14 | element: PsiElement, 15 | context: ProcessingContext 16 | ): Array { 17 | val kind = (element as? TomlLiteral)?.kind ?: return emptyArray() 18 | if (kind !is TomlLiteralKind.String) return emptyArray() 19 | 20 | return FileReferenceSet(element).allReferences 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/toml/MoveTomlReferenceContributor.kt: -------------------------------------------------------------------------------- 1 | package org.sui.toml 2 | 3 | import com.intellij.psi.PsiReferenceContributor 4 | import com.intellij.psi.PsiReferenceRegistrar 5 | 6 | class MoveTomlReferenceContributor : PsiReferenceContributor() { 7 | override fun registerReferenceProviders(registrar: PsiReferenceRegistrar) { 8 | registrar.registerReferenceProvider( 9 | MoveTomlPsiPatterns.dependencyLocal(), MoveTomlLocalPathReferenceProvider() 10 | ) 11 | registrar.registerReferenceProvider( 12 | MoveTomlPsiPatterns.dependencyGitUrl(), MoveTomlUrlReferenceProvider() 13 | ) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/toml/MoveTomlUrlReferenceProvider.kt: -------------------------------------------------------------------------------- 1 | package org.sui.toml 2 | 3 | import com.intellij.openapi.paths.WebReference 4 | import com.intellij.psi.PsiElement 5 | import com.intellij.psi.PsiReference 6 | import com.intellij.psi.PsiReferenceProvider 7 | import com.intellij.util.ProcessingContext 8 | import org.toml.lang.psi.TomlLiteral 9 | import org.toml.lang.psi.ext.TomlLiteralKind 10 | import org.toml.lang.psi.ext.kind 11 | 12 | class MoveTomlUrlReferenceProvider : PsiReferenceProvider() { 13 | override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array { 14 | val literal = element as? TomlLiteral ?: return emptyArray() 15 | val kind = (literal.kind as? TomlLiteralKind.String) ?: return emptyArray() 16 | val value = kind.value ?: return emptyArray() 17 | 18 | if (value.startsWith("http://") || value.startsWith("https://")) { 19 | return arrayOf(WebReference(element, value)) 20 | } 21 | return emptyArray() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/toml/NamedAddressReferenceContributor.kt: -------------------------------------------------------------------------------- 1 | package org.sui.toml 2 | 3 | import com.intellij.psi.* 4 | import com.intellij.util.ProcessingContext 5 | import org.sui.lang.core.MvPsiPattern 6 | import org.sui.lang.core.psi.MvNamedAddress 7 | import org.sui.lang.core.resolve.ref.NamedAddressReference 8 | 9 | class NamedAddressReferenceProvider : PsiReferenceProvider() { 10 | override fun getReferencesByElement( 11 | element: PsiElement, 12 | context: ProcessingContext 13 | ): Array { 14 | if (element !is MvNamedAddress) return emptyArray() 15 | return arrayOf(NamedAddressReference(element)) 16 | } 17 | } 18 | 19 | class NamedAddressReferenceContributor : PsiReferenceContributor() { 20 | override fun registerReferenceProviders(registrar: PsiReferenceRegistrar) { 21 | registrar.registerReferenceProvider( 22 | MvPsiPattern.namedAddress(), NamedAddressReferenceProvider() 23 | ) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/toml/completion/MoveTomlCompletionContributor.kt: -------------------------------------------------------------------------------- 1 | package org.sui.toml.completion 2 | 3 | import com.intellij.codeInsight.completion.CompletionContributor 4 | import com.intellij.codeInsight.completion.CompletionType 5 | import org.sui.toml.MoveTomlPsiPatterns.inKey 6 | 7 | class MoveTomlCompletionContributor : CompletionContributor() { 8 | init { 9 | extend(CompletionType.BASIC, inKey, MoveTomlKeysCompletionProvider()) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/toml/utils.kt: -------------------------------------------------------------------------------- 1 | package org.sui.toml 2 | 3 | import org.toml.lang.psi.TomlKeySegment 4 | import org.toml.lang.psi.TomlTableHeader 5 | 6 | val TomlKeySegment.isDependencyKey: Boolean 7 | get() { 8 | val name = name 9 | return name == "dependencies" || name == "dev-dependencies" 10 | } 11 | 12 | val TomlTableHeader.isDependencyListHeader: Boolean 13 | get() = key?.segments?.lastOrNull()?.isDependencyKey == true 14 | 15 | val TomlKeySegment.isAddressesKey: Boolean 16 | get() { 17 | val name = name 18 | return name == "addresses" || name == "dev-addresses" 19 | } 20 | 21 | val TomlTableHeader.isAddressesListHeader: Boolean 22 | get() = key?.segments?.lastOrNull()?.isDependencyKey == true 23 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/utils/PlatformUtils.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils 2 | 3 | import com.intellij.openapi.util.Computable 4 | import com.intellij.openapi.util.RecursionManager 5 | 6 | fun recursionGuard(key: Any, block: Computable, memoize: Boolean = false): T? = 7 | RecursionManager.doPreventingRecursion(key, memoize, block) 8 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/utils/SignatureUtils.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils 2 | 3 | import org.sui.stdext.joinToWithBuffer 4 | 5 | object SignatureUtils { 6 | fun joinParameters(params: List>): String = 7 | buildString { 8 | append("(") 9 | params.joinToWithBuffer(this, separator = ", ") { sb -> 10 | val (name, type) = this 11 | sb.append(name) 12 | if (type != null) { 13 | sb.append(": ") 14 | sb.append(type) 15 | } 16 | } 17 | append(")") 18 | } 19 | } -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/utils/paths.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils 2 | 3 | import com.intellij.openapi.components.service 4 | import com.intellij.openapi.project.Project 5 | import com.intellij.openapi.vfs.VirtualFile 6 | import com.intellij.openapi.vfs.VirtualFileManager 7 | import java.nio.file.Path 8 | import java.nio.file.Paths 9 | 10 | interface SuiProjectRootService { 11 | val path: Path? 12 | 13 | val pathFile: VirtualFile? 14 | get() = path?.let { VirtualFileManager.getInstance().findFileByNioPath(it) } 15 | } 16 | 17 | class SuiProjectRootServiceImpl(private val project: Project) : SuiProjectRootService { 18 | override val path: Path? 19 | get() = project.basePath?.let { Paths.get(it) } 20 | } 21 | 22 | class TestSuiProjectRootServiceImpl(private val project: Project) : SuiProjectRootService { 23 | private var _path: Path = Paths.get("") 24 | 25 | override val path: Path 26 | get() = _path 27 | 28 | fun modifyPath(path: Path) { 29 | _path = path 30 | } 31 | } 32 | 33 | val Project.rootService: SuiProjectRootService get() = service() 34 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/utils/refactor.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils 2 | 3 | import com.intellij.psi.PsiElement 4 | import org.sui.ide.refactoring.isValidMoveVariableIdentifier 5 | import org.sui.lang.MvElementTypes 6 | import org.sui.lang.core.psi.MvPsiFactory 7 | import org.sui.lang.core.psi.ext.elementType 8 | 9 | fun doRenameIdentifier(identifier: PsiElement, newName: String) { 10 | val factory = MvPsiFactory(identifier.project) 11 | val newIdentifier = when (identifier.elementType) { 12 | MvElementTypes.IDENTIFIER -> { 13 | if (!isValidMoveVariableIdentifier(newName)) return 14 | factory.identifier(newName) 15 | } 16 | else -> error("Unsupported identifier type for `$newName` (${identifier.elementType})") 17 | } 18 | identifier.replace(newIdentifier) 19 | } 20 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/utils/ui/CompletionTextField.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils.ui 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.intellij.ui.TextFieldWithAutoCompletion 5 | 6 | class CompletionTextField( 7 | project: Project, 8 | initialValue: String, 9 | variants: Collection, 10 | ) : 11 | TextFieldWithAutoCompletion( 12 | project, 13 | StringsCompletionProvider(variants, null), 14 | false, 15 | initialValue 16 | ) 17 | -------------------------------------------------------------------------------- /src/main/kotlin/org/sui/utils/ui/compat.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils.ui 2 | 3 | import com.intellij.openapi.project.DumbService 4 | import com.intellij.openapi.project.Project 5 | import com.intellij.openapi.ui.popup.JBPopup 6 | 7 | object NavigationUtilCompat { 8 | fun hidePopupIfDumbModeStarts(popup: JBPopup, project: Project) { 9 | if (!DumbService.isDumb(project)) { 10 | project.messageBus.connect(popup) 11 | .subscribe(DumbService.DUMB_MODE, object: DumbService.DumbModeListener { 12 | override fun enteredDumbMode() { 13 | popup.cancel() 14 | } 15 | }) 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/fileTemplates/internal/Move File.move.ft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/src/main/resources/fileTemplates/internal/Move File.move.ft -------------------------------------------------------------------------------- /src/main/resources/fileTemplates/internal/Move Module.move.ft: -------------------------------------------------------------------------------- 1 | module ${ADDRESS}::${NAME} { 2 | } 3 | -------------------------------------------------------------------------------- /src/main/resources/fileTemplates/internal/Move Test Module.move.ft: -------------------------------------------------------------------------------- 1 | #[test_only] 2 | module ${ADDRESS}::${NAME} { 3 | } 4 | -------------------------------------------------------------------------------- /src/main/resources/fileTemplates/internal/Sui Move File.move.ft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/src/main/resources/fileTemplates/internal/Sui Move File.move.ft -------------------------------------------------------------------------------- /src/main/resources/fileTemplates/internal/Sui Move Module.move.ft: -------------------------------------------------------------------------------- 1 | module ${ADDRESS}::${NAME} { 2 | } 3 | -------------------------------------------------------------------------------- /src/main/resources/fileTemplates/internal/Sui Move Test Module.move.ft: -------------------------------------------------------------------------------- 1 | #[test_only] 2 | module ${ADDRESS}::${NAME} { 3 | } 4 | -------------------------------------------------------------------------------- /src/main/resources/icons/annotationtype.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/src/main/resources/icons/annotationtype.png -------------------------------------------------------------------------------- /src/main/resources/icons/annotationtype@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/src/main/resources/icons/annotationtype@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/enum.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/icons/enumVariant.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/icons/module.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/icons/mv.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/AddressByValueImport.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Detects imports that valid by address value, but invalid by address name.

4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/FieldInitShorthand.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Reports cases where field initialization shorthand can be used. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/InvalidModuleDeclaration.html: -------------------------------------------------------------------------------- 1 | Invalid module declaration. The module does not have a specified address / address block. 2 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvAbilityCheck.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Check abilities. WIP: emits false-positives in some cases.

4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvConstNaming.html: -------------------------------------------------------------------------------- 1 | Checks if constant names follow the Mv naming convention. 2 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvExternalLinter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This inspection runs external linter to check for aptos-cli compiler errors. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvFunctionNaming.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Checks function naming.

4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvLocalBindingNaming.html: -------------------------------------------------------------------------------- 1 | Checks if local variable names follow the Mv naming convention. 2 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvMissingAcquires.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Missing acquires

4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvStructNaming.html: -------------------------------------------------------------------------------- 1 | Checks if struct names follow the Mv naming convention. 2 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvTypeCheck.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Type checking

4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvUnresolvedReference.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Reports unresolved references. This inspection can report false positives. 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvUnusedAcquiresType.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Unused acquires type

4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvUnusedImport.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Detects unused import. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/MvUnusedVariable.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Detects unused variables and function parameters. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/PhantomTypeParameter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Checks whether a type parameter could be declared phantom. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/RedundantQualifiedPath.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Marks redundant qualified path. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/RedundantTypeCast.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Detects redundant cast expressions. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/ReplaceWithIndexExpr.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Detects built-in global storage calls which can be replaced with the index notation. 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/ReplaceWithMethodCall.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Detects ability to use receiver-style function (Compiler V2 only). 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/UnusedTestSigner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Detects unused #[test] attribute signer variable.

4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ChopAttrArgumentListIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Put attr arguments on separate lines. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ChopParameterListIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Put parameter on separate lines. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ChopStructLiteralIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chop struct literal. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ChopStructPatIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chop struct pat intention. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ChopValueArgumentListIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Put arguments on separate lines. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/InlineAddressBlockIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Inline address block. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/RemoveCurlyBracesIntention/description.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Removes enclosing curly braces from use item. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/messages/MvBundle.properties: -------------------------------------------------------------------------------- 1 | advanced.setting.aptos.group=Aptos 2 | advanced.setting.org.move.aptos.test.tool.window=Show test results in Test Tool Window 3 | advanced.setting.org.move.aptos.test.tool.window.description=The feature implementation is incomplete, test error messages are skipped 4 | advanced.setting.sui.group=Aptos 5 | advanced.setting.org.move.sui.test.tool.window=Show test results in Test Tool Window 6 | advanced.setting.org.move.sui.test.tool.window.description=The feature implementation is incomplete, test error messages are skipped 7 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/cli/externalSystem/ImportTreeProjectTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.cli.externalSystem 2 | 3 | import org.sui.utils.tests.MvProjectTestBase 4 | 5 | class ImportTreeProjectTest : MvProjectTestBase() { 6 | fun `test import project with circular dependencies no stackoverflow`() { 7 | testProject { 8 | moveToml( 9 | """ 10 | [package] 11 | name = "MyPackage" 12 | 13 | [dependencies] 14 | MyLocal = { local = "." } 15 | """ 16 | ) 17 | sources { main("/*caret*/") } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/FoldingBuilderTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide 2 | 3 | import org.sui.utils.tests.MvTestBase 4 | 5 | class FoldingBuilderTest : MvTestBase() { 6 | override val dataPath = "org.sui.ide/folding.fixtures" 7 | 8 | fun `test script`() = doTest() 9 | fun `test module`() = doTest() 10 | fun `test script with parameters`() = doTest() 11 | 12 | private fun doTest() { 13 | myFixture.testFolding("$testDataPath/$fileName") 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/MvBreadcrumbsProviderTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide 2 | 3 | import com.intellij.testFramework.UsefulTestCase 4 | import org.intellij.lang.annotations.Language 5 | import org.sui.utils.tests.MvTestBase 6 | 7 | class MvBreadcrumbsProviderTest : MvTestBase() { 8 | fun `test breadcrumbs`() = doTextTest( 9 | """ 10 | module 0x1::M { 11 | fun main() { 12 | while (true) if (true) /*caret*/; 13 | } 14 | } 15 | """, """ 16 | 0x1::M 17 | main() 18 | {...} 19 | while (true) 20 | if (true) 21 | """ 22 | ) 23 | 24 | private fun doTextTest(@Language("Sui Move") content: String, info: String) { 25 | InlineFile(content.trimIndent()) 26 | val crumbs = myFixture.breadcrumbsAtCaret.joinToString(separator = "\n") { it.text } 27 | UsefulTestCase.assertSameLines(info.trimIndent(), crumbs) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/annotator/errors/BuiltInFunctionNameErrorTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.annotator.errors 2 | 3 | import org.sui.ide.annotator.MvErrorAnnotator 4 | import org.sui.utils.tests.annotation.AnnotatorTestCase 5 | 6 | class BuiltInFunctionNameErrorTest : AnnotatorTestCase(MvErrorAnnotator::class) { 7 | fun `test function`() = checkErrors( 8 | """ 9 | module 0x1::M { 10 | fun move_to() {} 11 | } 12 | """ 13 | ) 14 | 15 | fun `test native function`() = checkErrors( 16 | """ 17 | module 0x1::M { 18 | native fun move_to(); 19 | } 20 | """ 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/annotator/syntaxErrors/NativeStructNotSupportedTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.annotator.syntaxErrors 2 | 3 | import org.sui.ide.annotator.MvSyntaxErrorAnnotator 4 | import org.sui.utils.tests.annotation.AnnotatorTestCase 5 | 6 | class NativeStructNotSupportedTest : AnnotatorTestCase(MvSyntaxErrorAnnotator::class) { 7 | fun `test native struct is not supported by the vm`() = checkWarnings( 8 | """ 9 | module 0x1::m { 10 | native struct S; 11 | } 12 | """ 13 | ) 14 | } -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/annotator/syntaxErrors/SpecFunRequiresReturnValueTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.annotator.syntaxErrors 2 | 3 | import org.sui.ide.annotator.MvSyntaxErrorAnnotator 4 | import org.sui.utils.tests.annotation.AnnotatorTestCase 5 | 6 | class SpecFunRequiresReturnValueTest : AnnotatorTestCase(MvSyntaxErrorAnnotator::class) { 7 | fun `test spec fun with explicit return value`() = checkWarnings( 8 | """ 9 | module 0x1::m { 10 | spec fun value(): u8 { 1 } 11 | spec fun vec(): vector { vector[1] } 12 | } 13 | """ 14 | ) 15 | 16 | fun `test spec fun requires return value`() = checkWarnings( 17 | """ 18 | module 0x1::m { 19 | spec fun value() {} 20 | spec fun vec() {} 21 | } 22 | """ 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/docs/MoveNamedAddressDocumentationTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.docs 2 | 3 | import org.sui.utils.tests.MvDocumentationProviderProjectTestCase 4 | 5 | class MvNamedModulePathDocumentationTest : MvDocumentationProviderProjectTestCase() { 6 | fun `test value of named address accessible from documentation`() = doTestByFileTree( 7 | { 8 | moveToml( 9 | """ 10 | [package] 11 | name = "UserInfo" 12 | version = "0.1.0" 13 | 14 | [addresses] 15 | Std = "0x42" 16 | """ 17 | ) 18 | sources { 19 | move( 20 | "main.move", """ 21 | module Std::Module {} 22 | //^ 23 | """ 24 | ) 25 | } 26 | }, 27 | "Std = \"0x42\"", block = MvDocumentationProvider::generateDoc 28 | ) 29 | } 30 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/formatter/FormatterTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.formatter 2 | 3 | import org.sui.utils.tests.MvFormatterTestBase 4 | 5 | class FormatterTest : MvFormatterTestBase() { 6 | fun `test blank lines`() = doTest() 7 | fun `test comments`() = doTest() 8 | fun `test address block`() = doTest() 9 | fun `test operators`() = doTest() 10 | fun `test functions`() = doTest() 11 | fun `test function parameters`() = doTest() 12 | fun `test specs`() = doTest() 13 | fun `test structs`() = doTest() 14 | fun `test inner block`() = doTest() 15 | fun `test expressions`() = doTest() 16 | fun `test chop wraps`() = doTest() 17 | } 18 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/inspections/InvalidModuleDeclarationInspectionTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.inspections 2 | 3 | import org.sui.utils.tests.annotation.InspectionTestBase 4 | 5 | class InvalidModuleDeclarationInspectionTest : InspectionTestBase(InvalidModuleDeclarationInspection::class) { 6 | fun `test module in address block - no error`() = checkByText( 7 | """ 8 | address 0x1 { module M {} } 9 | """ 10 | ) 11 | 12 | fun `test module with inline address - no error`() = checkByText( 13 | """ 14 | module 0x1::M {} 15 | """ 16 | ) 17 | 18 | fun `test error if no address block or address specified`() = checkByText( 19 | """ 20 | module M {} 21 | """ 22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/intentions/ChopAttrArgumentListIntentionTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.intentions 2 | 3 | import org.sui.utils.tests.MvIntentionTestCase 4 | 5 | class ChopAttrArgumentListIntentionTest : MvIntentionTestCase(ChopAttrArgumentListIntention::class) { 6 | fun `test separate lines for test attributes`() = doAvailableTest( 7 | """ 8 | module 0x1::M { 9 | #[test(/*caret*/signer1 = @0x1, signer2 = @0x2, signer3 = @0x3)] 10 | fun test_my_function() { 11 | 12 | } 13 | } 14 | """, """ 15 | module 0x1::M { 16 | #[test( 17 | signer1 = @0x1, 18 | signer2 = @0x2, 19 | signer3 = @0x3 20 | )] 21 | fun test_my_function() { 22 | 23 | } 24 | } 25 | """ 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/intentions/ChopStructLiteralIntentionTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.intentions 2 | 3 | import org.sui.utils.tests.MvIntentionTestCase 4 | 5 | class ChopStructLiteralIntentionTest : MvIntentionTestCase(ChopStructLiteralIntention::class) { 6 | fun `test separate lines for test attributes`() = doAvailableTest( 7 | """ 8 | module 0x1::M { 9 | struct S { val1: u8, val2: u8 } 10 | fun test_my_function() { 11 | S { /*caret*/val1: u8, val2: u8 }; 12 | } 13 | } 14 | """, """ 15 | module 0x1::M { 16 | struct S { val1: u8, val2: u8 } 17 | fun test_my_function() { 18 | S { 19 | val1: u8, 20 | val2: u8 21 | }; 22 | } 23 | } 24 | """ 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/intentions/ChopValueArgumentListIntentionTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.intentions 2 | 3 | import org.sui.utils.tests.MvIntentionTestCase 4 | 5 | class ChopValueArgumentListIntentionTest : MvIntentionTestCase(ChopValueArgumentListIntention::class) { 6 | fun `test separate arguments in call expr`() = doAvailableTest( 7 | """ 8 | module 0x1::main { 9 | fun call(foo: u8, bar: u8, baz: u8) {} 10 | fun main() { 11 | call(/*caret*/1, 2, 3); 12 | } 13 | } 14 | """, """ 15 | module 0x1::main { 16 | fun call(foo: u8, bar: u8, baz: u8) {} 17 | fun main() { 18 | call( 19 | 1, 20 | 2, 21 | 3 22 | ); 23 | } 24 | } 25 | """ 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/lineMarkers/ItemSpecsLineMarkerProviderTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.lineMarkers 2 | 3 | import org.sui.utils.tests.lineMarkers.LineMarkerProviderTestBase 4 | 5 | class ItemSpecsLineMarkerProviderTest : LineMarkerProviderTestBase() { 6 | fun `test no specifications`() = doTestByText( 7 | """ 8 | module 0x1::m { 9 | fun call() {} 10 | } 11 | module 0x1::m2 {} 12 | module 0x1::m3 {} 13 | """ 14 | ) 15 | 16 | fun `test item specifications`() = doTestByText( 17 | """ 18 | module 0x1::m { // - Has specifications 19 | fun call() {} // - Has specifications 20 | 21 | } 22 | spec 0x1::m { 23 | spec call {} 24 | } 25 | """ 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/refactoring/optimizeImports/OptimizeImportsTestBase.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.refactoring.optimizeImports 2 | 3 | import org.intellij.lang.annotations.Language 4 | import org.sui.ide.inspections.MvUnusedImportInspection 5 | import org.sui.utils.tests.MvTestBase 6 | import org.sui.utils.tests.WithEnabledInspections 7 | 8 | @WithEnabledInspections(MvUnusedImportInspection::class) 9 | abstract class OptimizeImportsTestBase : MvTestBase() { 10 | 11 | protected fun doTest(@Language("Sui Move") before: String, @Language("Sui Move") after: String) = 12 | checkEditorAction(before, after, "OptimizeImports") 13 | } 14 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/structureView/HidePrivateFunctionsFilterTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.structureView 2 | 3 | class HidePrivateFunctionsFilterTest : StructureViewToggleableActionTestBase() { 4 | fun `test hide private functions filter`() = doTest( 5 | """ 6 | module 0x1::m { 7 | public fun public_main() {} 8 | fun private_main() {} 9 | } 10 | """, """ 11 | -main.move 12 | -m 13 | public_main() 14 | private_main() 15 | """, """ 16 | -main.move 17 | -m 18 | public_main() 19 | """ 20 | ) 21 | 22 | override val actionId: String get() = HidePrivateFunctionsFilter.ID 23 | } -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/structureView/HideTestFunctionsFilterTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.structureView 2 | 3 | class HideTestFunctionsFilterTest : StructureViewToggleableActionTestBase() { 4 | fun `test hide test functions filter`() = doTest( 5 | """ 6 | module 0x1::m { 7 | fun main() {} 8 | #[test] 9 | fun test_main() {} 10 | } 11 | """, """ 12 | -main.move 13 | -m 14 | main() 15 | test_main() 16 | """, """ 17 | -main.move 18 | -m 19 | main() 20 | """ 21 | ) 22 | 23 | override val actionId: String get() = HideTestFunctionsFilter.ID 24 | } -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/structureView/HideTestOnlyItemsFilterTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.structureView 2 | 3 | class HideTestOnlyItemsFilterTest : StructureViewToggleableActionTestBase() { 4 | fun `test hide test only items filter`() = doTest( 5 | """ 6 | module 0x1::m { 7 | struct S {} 8 | #[test_only] 9 | struct ST {} 10 | 11 | fun main() {} 12 | #[test_only] 13 | fun main_t() {} 14 | } 15 | """, """ 16 | -main.move 17 | -m 18 | S 19 | ST 20 | main() 21 | main_t() 22 | """, """ 23 | -main.move 24 | -m 25 | S 26 | main() 27 | """ 28 | ) 29 | 30 | override val actionId: String get() = HideTestOnlyItemsFilter.ID 31 | } -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/structureView/StructureViewToggleableActionTestBase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Use of this source code is governed by the MIT license that can be 3 | * found in the LICENSE file. 4 | */ 5 | 6 | package org.sui.ide.structureView 7 | 8 | import org.intellij.lang.annotations.Language 9 | 10 | abstract class StructureViewToggleableActionTestBase : StructureViewTestBase() { 11 | protected abstract val actionId: String 12 | 13 | protected fun doTest(@Language("Sui Move") code: String, disabled: String, enabled: String) = 14 | doTestStructureView(code) { 15 | setActionActive(actionId, false) 16 | assertTreeEqual(tree, disabled.trimMargin()) 17 | setActionActive(actionId, true) 18 | assertTreeEqual(tree, enabled.trimMargin()) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/ide/typing/EnterInLineCommentHandlerTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.ide.typing 2 | 3 | import org.sui.utils.tests.MvTypingTestCase 4 | 5 | class EnterInLineCommentHandlerTest: MvTypingTestCase() { 6 | override val dataPath = "org.sui.ide/typing/lineComment.fixtures" 7 | 8 | fun `test in outer doc comment`() = doTestByText(""" 9 | /// multiply by two 10 | module 0x1::M {} 11 | """, """ 12 | /// multi 13 | /// ply by two 14 | module 0x1::M {} 15 | """) 16 | 17 | fun `test after outer doc comment`() = doTest() 18 | } 19 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/lang/lexer/LexerTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.lexer 2 | 3 | import org.sui.utils.tests.MvLexerTestBase 4 | 5 | class LexerTest : MvLexerTestBase() { 6 | fun `test block comments`() = doTest() 7 | } 8 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/lang/parser/PartialParsingTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.parser 2 | 3 | import org.sui.utils.tests.parser.MvParsingTestCase 4 | 5 | class PartialParsingTest : MvParsingTestCase("partial") { 6 | // top level items recovery 7 | fun `test top level items`() = doTest(true) 8 | fun `test module const`() = doTest(true) 9 | // fun `test module uses`() = doTest(true) 10 | 11 | fun `test spec`() = doTest(true) 12 | 13 | // functions 14 | fun `test function signatures`() = doTest(true) 15 | fun `test function calls`() = doTest(true) 16 | 17 | // structs 18 | fun `test struct decls`() = doTest(true) 19 | fun `test struct fields`() = doTest(true) 20 | 21 | // expressions 22 | fun `test expressions`() = doTest(true) 23 | fun `test assignments`() = doTest(true) 24 | fun `test dot exprs`() = doTest(true) 25 | } 26 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/lang/parser/SpecsParsingTest.kt: -------------------------------------------------------------------------------- 1 | package org.sui.lang.parser 2 | 3 | import org.sui.utils.tests.parser.MvParsingTestCase 4 | 5 | class SpecsParsingTest : MvParsingTestCase("specs") { 6 | fun `test scopes`() = doTest() 7 | fun `test conditions`() = doTest() 8 | fun `test forall exists`() = doTest() 9 | fun `test pragma`() = doTest() 10 | 11 | fun `test apply`() = doTest() 12 | fun `test spec statements`() = doTest(true, false) 13 | fun `test spec file`() = doTest() 14 | fun `test spec properties`() = doTest() 15 | fun `test spec variables`() = doTest() 16 | 17 | fun doTest() { 18 | super.doTest(true, true) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/utils/tests/InlineFile.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Use of this source code is governed by the MIT license that can be 3 | * found in the LICENSE file. 4 | */ 5 | 6 | package org.sui.utils.tests 7 | 8 | import com.intellij.testFramework.fixtures.CodeInsightTestFixture 9 | 10 | class InlineFile(fixture: CodeInsightTestFixture, private val code: String, val name: String) { 11 | private val hasCaretMarker = "/*caret*/" in code || "" in code 12 | 13 | init { 14 | fixture.configureByText(name, replaceCaretMarker(code)) 15 | } 16 | 17 | fun withCaret() { 18 | check(hasCaretMarker) { 19 | "Please, add `/*caret*/` or `` marker to\n$code" 20 | } 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/utils/tests/MvFormatterTestBase.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils.tests 2 | 3 | import com.intellij.psi.formatter.FormatterTestCase 4 | import org.intellij.lang.annotations.Language 5 | import org.sui.utils.tests.base.TestCase 6 | 7 | abstract class MvFormatterTestBase : FormatterTestCase() { 8 | override fun getTestDataPath() = "src/test/resources" 9 | override fun getBasePath(): String = "org/move/ide/formatter.fixtures" 10 | override fun getFileExtension() = "move" 11 | 12 | override fun getTestName(lowercaseFirstLetter: Boolean): String { 13 | val camelCase = super.getTestName(lowercaseFirstLetter) 14 | return TestCase.camelOrWordsToSnake(camelCase) 15 | } 16 | 17 | override fun doTextTest(@Language("Move") text: String, @Language("Move") textAfter: String) { 18 | check(text.trimIndent() != textAfter.trimIndent()) { 19 | "Formatter before and after should be different" 20 | } 21 | super.doTextTest(text.trimIndent(), textAfter.trimIndent()) 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/utils/tests/MvLightTestBase.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils.tests 2 | 3 | import com.intellij.testFramework.fixtures.BasePlatformTestCase 4 | 5 | abstract class MvLightTestBase : BasePlatformTestCase() { 6 | override fun setUp() { 7 | super.setUp() 8 | 9 | val isDebugMode = this.findAnnotationInstance()?.enabled ?: true 10 | setRegistryKey("org.move.debug.enabled", isDebugMode) 11 | 12 | this.handleCompilerV2Annotations(project) 13 | this.handleNamedAddressAnnotations(project) 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/utils/tests/MvTypingTestCase.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils.tests 2 | 3 | import org.intellij.lang.annotations.Language 4 | import org.sui.lang.MoveFileType 5 | 6 | abstract class MvTypingTestCase : MvTestBase() { 7 | protected fun doTest(c: Char = '\n') = checkByFile { 8 | myFixture.type(c) 9 | } 10 | 11 | protected fun doTest(@Language("Move") before: String, type: Char, @Language("Move") after: String) { 12 | val beforeText = replaceCaretMarker(before) 13 | val afterText = replaceCaretMarker(after) 14 | 15 | myFixture.configureByText(MoveFileType, beforeText) 16 | myFixture.type(type) 17 | myFixture.checkResult(afterText) 18 | } 19 | 20 | protected fun doTestByText( 21 | @Language("Move") before: String, 22 | @Language("Move") after: String, 23 | c: Char = '\n' 24 | ) = 25 | checkByText(before.trimIndent(), after.trimIndent()) { 26 | myFixture.type(c) 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/utils/tests/Settings.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils.tests 2 | 3 | import junit.framework.TestCase 4 | 5 | /** Tries to find the specified annotation on the current test method and then on the current class */ 6 | inline fun TestCase.findAnnotationInstance(): T? = 7 | javaClass.getMethod(name).getAnnotation(T::class.java) ?: javaClass.getAnnotation(T::class.java) 8 | 9 | /** Tries to find the specified annotation on the current test method and then on the current class */ 10 | inline fun TestCase.findAnnotationInstances(): Array = 11 | javaClass.getMethod(name).getAnnotationsByType(T::class.java) ?: javaClass.getAnnotationsByType(T::class.java) 12 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/utils/tests/annotation/AnnotatorTestCase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Use of this source code is governed by the MIT license that can be 3 | * found in the LICENSE file. 4 | */ 5 | 6 | package org.sui.utils.tests.annotation 7 | 8 | import org.intellij.lang.annotations.Language 9 | import org.sui.ide.annotator.MvAnnotatorBase 10 | import kotlin.reflect.KClass 11 | 12 | abstract class AnnotatorTestCase( 13 | private val annotatorClass: KClass 14 | ) : MvAnnotationTestCase() { 15 | 16 | override fun createAnnotationFixture(): MvAnnotationTestFixture = 17 | MvAnnotationTestFixture(this, myFixture, annotatorClasses = listOf(annotatorClass)) 18 | 19 | protected fun checkFixByText( 20 | fixName: String, 21 | @Language("Move") before: String, 22 | @Language("Move") after: String, 23 | checkWarn: Boolean = true, 24 | checkInfo: Boolean = false, 25 | checkWeakWarn: Boolean = false, 26 | ) = 27 | annotationFixture.checkFixByText(fixName, before, after, checkWarn, checkInfo, checkWeakWarn) 28 | } 29 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/utils/tests/base/TestCase.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils.tests.base 2 | 3 | import java.nio.file.Path 4 | import java.nio.file.Paths 5 | 6 | interface TestCase { 7 | val testFileExtension: String 8 | fun getTestDataPath(): String 9 | fun getTestName(lowercaseFirstLetter: Boolean): String 10 | 11 | companion object { 12 | const val testResourcesPath = "src/test/resources" 13 | 14 | @JvmStatic 15 | fun camelOrWordsToSnake(name: String): String { 16 | if (' ' in name) 17 | return name.trim().replace(" ", "_") 18 | return name.split("(?=[A-Z])".toRegex()).joinToString("_", transform = String::lowercase) 19 | } 20 | } 21 | } 22 | 23 | fun TestCase.pathToSourceTestFile(): Path = 24 | Paths.get("${TestCase.testResourcesPath}/${getTestDataPath()}/${getTestName(true)}.$testFileExtension") 25 | 26 | fun TestCase.pathToGoldTestFile(): Path = 27 | Paths.get("${TestCase.testResourcesPath}/${getTestDataPath()}/${getTestName(true)}.txt") 28 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/utils/tests/common.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils.tests 2 | 3 | import org.jetbrains.annotations.TestOnly 4 | import org.sui.cli.MoveProject 5 | import org.sui.cli.MoveProjectsService 6 | 7 | @TestOnly 8 | fun MoveProjectsService.singleProject(): MoveProject { 9 | return when (allProjects.size) { 10 | 0 -> error("No cargo projects found") 11 | 1 -> allProjects.single() 12 | else -> error("Expected single cargo project, found multiple: $allProjects") 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/kotlin/org/sui/utils/tests/lineMarkers/LineMarkerProviderTestBase.kt: -------------------------------------------------------------------------------- 1 | package org.sui.utils.tests.lineMarkers 2 | 3 | import org.intellij.lang.annotations.Language 4 | import org.sui.utils.tests.MvTestBase 5 | 6 | abstract class LineMarkerProviderTestBase : MvTestBase() { 7 | 8 | protected lateinit var lineMarkerTestHelper: LineMarkerTestHelper 9 | 10 | override fun setUp() { 11 | super.setUp() 12 | lineMarkerTestHelper = LineMarkerTestHelper(myFixture) 13 | } 14 | 15 | protected fun doTestByText(@Language("Move") source: String) { 16 | lineMarkerTestHelper.doTestByText("main.move", source) 17 | } 18 | 19 | // protected fun doTestByFileTree(filePath: String, builder: FileTreeBuilder.() -> Unit) { 20 | // val fileTree = fileTree(builder) 21 | // val testProject = fileTree(builder).toTestProject(project, ) 22 | // lineMarkerTestHelper.doTestFromFile(testProject.file(filePath)) 23 | // } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/META-INF/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | org.sui.lang 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/test/resources/move_toml_project/.aptos/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | profiles: 3 | default: 4 | private_key: "0x1f9abf8196bd6b34731fdf99da384180ee43002befac0e55f39aceed9869e321" 5 | public_key: "0x21dae149d5c16ec825558eb86c6434a2aa4bd1a54b66430dfdea983f3f5faaec" 6 | account: 2ec4190dd6eec80913e02da22de89700a9b5e13e27b51750191b7ceb3eee1a2f 7 | rest_url: "https://fullnode.testnet.aptoslabs.com" 8 | emergency: 9 | private_key: "0x3976a9fa9196a4e0240e64d1837fec879d65229194aef942fb81a7b41ff62912" 10 | public_key: "0xb1af70c600661e19d631296d89b8fd51aecafd2e7da76d27a9f462046647e17e" 11 | account: c5f39b983cf06b9e26dc149b3a8c0d7fcb27733954fa86eff7f3c70427644b1f 12 | rest_url: "https://fullnode.testnet.aptoslabs.com" 13 | -------------------------------------------------------------------------------- /src/test/resources/move_toml_project/Move.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "move_toml" 3 | version = "0.1.0" 4 | 5 | [addresses] 6 | Std = "0x1" 7 | DiemFramework = "0xB1E55ED" 8 | 9 | [dependencies] 10 | Debug = { local = "./stdlib/Debug.move" } 11 | -------------------------------------------------------------------------------- /src/test/resources/move_toml_project/stdlib/debug.move: -------------------------------------------------------------------------------- 1 | address 0x1 { 2 | 3 | module Debug { 4 | native public fun print(x: &T); 5 | native public fun print_stack_trace(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/function_call/run_command_for_entry_function_call_with_no_arguments.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/function_call/run_command_for_entry_function_call_with_one_argument.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/function_call/view_command_for_view_function_call_with_no_arguments.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/function_call/view_command_for_view_function_call_with_one_argument.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/run_tests_for_file_with_multiple_module_single_test_module.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/run_tests_for_file_with_one_module.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/run_tests_for_function_if_inside_non_test_only_module.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/run_tests_for_module_with_test_function.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/run_tests_for_move_package_from_root.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/run_tests_for_move_package_from_tests_directory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/run_tests_for_move_toml_file.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/test_run_for_compiler_v2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/test_run_for_compiler_v2_without_cli_flag.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/test_run_for_function.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/test_run_for_function_dumping_state_on_test_failure.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/test_run_for_function_skipping_fetch_git_deps.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/cli/producers.fixtures/test/test_run_for_module_with_test_functions_inside_sources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/folding.fixtures/module.move: -------------------------------------------------------------------------------- 1 | /// my docstring 2 | /// my other docstring 3 | module 0x1::M { 4 | const MY_CONST: u64 = 1; 5 | const MY_CONST_2: u64 = 1; 6 | 7 | /// my docstring 8 | /// my other docstring 9 | fun main() acquires A, B, C { 10 | let a = 1; 11 | } 12 | 13 | spec main { 14 | assert true; 15 | } 16 | 17 | spec fun spec_fun { 18 | assert true; 19 | } 20 | 21 | spec module {} 22 | 23 | /// my docstring 24 | /// my other docstring 25 | struct R { val: u8 } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/folding.fixtures/script.move: -------------------------------------------------------------------------------- 1 | script { 2 | use use 0x1::Main; 3 | use 0x1::Main2; 4 | fun main() { 5 | let a = 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/folding.fixtures/script_with_parameters.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main(s: &signer, a: u8) { 3 | let a = 1; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/address_block.move: -------------------------------------------------------------------------------- 1 | address 0x0{ 2 | // comment 3 | // second comment 4 | module M{ 5 | use 0x0::Transaction; 6 | struct MyStruct{} 7 | fun main(){} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/address_block_after.move: -------------------------------------------------------------------------------- 1 | address 0x0 { 2 | // comment 3 | // second comment 4 | module M { 5 | use 0x0::Transaction; 6 | 7 | struct MyStruct {} 8 | 9 | fun main() {} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/blank_lines.move: -------------------------------------------------------------------------------- 1 | script { 2 | use 0x0::Transaction; 3 | use 0x0::Account; 4 | // use 0x0::Signer; 5 | use 0x0::XFI; 6 | 7 | fun main() {} 8 | 9 | 10 | } 11 | 12 | script { 13 | fun main() { 14 | let a = 1; let b = 2; 15 | 16 | let c = 3; // comment 17 | } 18 | 19 | 20 | 21 | } 22 | 23 | module MM { 24 | use 0x0::Transaction; 25 | use 0x0::Account; 26 | // use 0x0::Signer; 27 | use 0x0::XFI; 28 | } 29 | 30 | address 0x0 { 31 | 32 | 33 | module M { 34 | 35 | } 36 | module M2 { 37 | use 0x0::Transaction; 38 | use 0x0::Account; 39 | 40 | fun main() {} 41 | 42 | struct MyStruct {} 43 | } 44 | } 45 | 46 | address 0x1 { 47 | 48 | module M2 { 49 | 50 | struct T {} 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/blank_lines_after.move: -------------------------------------------------------------------------------- 1 | script { 2 | use 0x0::Transaction; 3 | use 0x0::Account; 4 | // use 0x0::Signer; 5 | use 0x0::XFI; 6 | 7 | fun main() {} 8 | } 9 | 10 | script { 11 | fun main() { 12 | let a = 1; 13 | let b = 2; 14 | 15 | let c = 3; // comment 16 | } 17 | } 18 | 19 | module MM { 20 | use 0x0::Transaction; 21 | use 0x0::Account; 22 | // use 0x0::Signer; 23 | use 0x0::XFI; 24 | } 25 | 26 | address 0x0 { 27 | 28 | module M {} 29 | 30 | module M2 { 31 | use 0x0::Transaction; 32 | use 0x0::Account; 33 | 34 | fun main() {} 35 | 36 | struct MyStruct {} 37 | } 38 | } 39 | 40 | address 0x1 { 41 | 42 | module M2 { 43 | 44 | struct T {} 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/chop_wraps.move: -------------------------------------------------------------------------------- 1 | module 0x1::chop_wraps { 2 | use 0x1::m::{long_function_1, long_function_2}; 3 | use 0x1::m::{long_function_1, long_function_2, long_function_3, long_function_4, long_function_5, long_function_6, long_function_7}; 4 | 5 | fun long_arguments(addr1: address, addr1: address, addr1: address, addr1: address, addr1: address, addr1: address) {} 6 | 7 | struct EventsStore has key { storage_registered_handle: event::EventHandle>, coin_deposited_handle: event::EventHandle>, coin_withdrawn_handle: event::EventHandle>, 8 | } 9 | 10 | #[test(account = @my_address, account = @my_address, account = @my_address, account = @my_address, account = @my_address, account = @my_address)] 11 | fun main() { 12 | call(1 + 2 + 3 + 4 + 5, 1 + 2 + 3 + 4 + 5, 1 + 2 + 3 + 4 + 5, 1 + 2 + 3 + 4 + 5, 1 + 2 + 3 + 4 + 5, 1 + 2 + 3 + 4 + 5) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/comments.move: -------------------------------------------------------------------------------- 1 | /// hello 2 | /// world 3 | /// my comment 4 | module 0x1::Comments { 5 | use 0x1::M; 6 | // other comment 7 | /// other docstring 8 | 9 | /// hello 10 | /// world 11 | /// my comment 12 | const MY_CONST: u64 = 1; 13 | 14 | /// hello 15 | /// world 16 | /// my comment 17 | struct M {} 18 | 19 | /// hello 20 | /// world 21 | /// my comment 22 | fun main() {} 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/comments_after.move: -------------------------------------------------------------------------------- 1 | /// hello 2 | /// world 3 | /// my comment 4 | module 0x1::Comments { 5 | use 0x1::M; 6 | 7 | // other comment 8 | /// other docstring 9 | 10 | /// hello 11 | /// world 12 | /// my comment 13 | const MY_CONST: u64 = 1; 14 | 15 | /// hello 16 | /// world 17 | /// my comment 18 | struct M {} 19 | 20 | /// hello 21 | /// world 22 | /// my comment 23 | fun main() {} 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/expressions.move: -------------------------------------------------------------------------------- 1 | module 0x1::expressions { 2 | fun main(): bool { 3 | if (true 4 | && false 5 | ) {}; 6 | 7 | if ( 8 | true 9 | && false 10 | ) 11 | true 12 | else 13 | false; 14 | 15 | vector[ 16 | 1, 17 | 1, 18 | ]; 19 | 20 | while (true) 21 | 1 + 1; 22 | 23 | return 1 == 2 24 | && (1 == 3 25 | && 1 == 4); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/expressions_after.move: -------------------------------------------------------------------------------- 1 | module 0x1::expressions { 2 | fun main(): bool { 3 | if (true 4 | && false 5 | ) {}; 6 | 7 | if ( 8 | true 9 | && false 10 | ) 11 | true 12 | else 13 | false; 14 | 15 | vector[ 16 | 1, 17 | 1, 18 | ]; 19 | 20 | while (true) 21 | 1 + 1; 22 | 23 | return 1 == 2 24 | && (1 == 3 25 | && 1 == 4); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/function_parameters.move: -------------------------------------------------------------------------------- 1 | module 0x1::function_parameters { 2 | fun prologue( 3 | a: u8, 4 | b: u8, 5 | c: u8, 6 | ): u8 {} 7 | 8 | spec prologue( 9 | a: u8, 10 | b: u8, 11 | c: u8, 12 | ): u8 {} 13 | 14 | spec fun prologue( 15 | a: u8, 16 | b: u8, 17 | c: u8, 18 | ): u8 {} 19 | 20 | spec module { 21 | fun prologue( 22 | a: u8, 23 | b: u8, 24 | c: u8, 25 | ): u8 {} 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/function_parameters_after.move: -------------------------------------------------------------------------------- 1 | module 0x1::function_parameters { 2 | fun prologue( 3 | a: u8, 4 | b: u8, 5 | c: u8, 6 | ): u8 {} 7 | 8 | spec prologue( 9 | a: u8, 10 | b: u8, 11 | c: u8, 12 | ): u8 {} 13 | 14 | spec fun prologue( 15 | a: u8, 16 | b: u8, 17 | c: u8, 18 | ): u8 {} 19 | 20 | spec module { 21 | fun prologue( 22 | a: u8, 23 | b: u8, 24 | c: u8, 25 | ): u8 {} 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/functions.move: -------------------------------------------------------------------------------- 1 | module M { 2 | fun main( ) {} 3 | fun main2 (a:u8, b : u8,c :u8 ) :u8 {} 4 | fun main3 < T , U > () {} 5 | fun main_signer(mysigner: &signer) {} 6 | fun main_signer2(mysigner: &mut signer) {} 7 | 8 | public fun public_main()acquires S {} 9 | 10 | public ( script ) fun public_script_main() {} 11 | 12 | public ( friend ) fun public_friend_main() {} 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/functions_after.move: -------------------------------------------------------------------------------- 1 | module M { 2 | fun main() {} 3 | 4 | fun main2(a: u8, b: u8, c: u8): u8 {} 5 | 6 | fun main3() {} 7 | 8 | fun main_signer(mysigner: &signer) {} 9 | 10 | fun main_signer2(mysigner: &mut signer) {} 11 | 12 | public fun public_main() acquires S {} 13 | 14 | public(script) fun public_script_main() {} 15 | 16 | public(friend) fun public_friend_main() {} 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/inner_block.move: -------------------------------------------------------------------------------- 1 | module 0x1::inner_block { 2 | fun call() { 3 | { 4 | let a = 1; 5 | }; 6 | spec { 7 | let a = 1; 8 | }; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/inner_block_after.move: -------------------------------------------------------------------------------- 1 | module 0x1::inner_block { 2 | fun call() { 3 | { 4 | let a = 1; 5 | }; 6 | spec { 7 | let a = 1; 8 | }; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/operators.move: -------------------------------------------------------------------------------- 1 | script { 2 | const A: u64 = 3 | 1; 4 | fun main() { 5 | let a=1; 6 | let b = 1+2+3+4; 7 | let c=a==b; 8 | let d = 9 | 4; 10 | e = 11 | 5; 12 | 13 | *b; 14 | *&b; 15 | *&*&*&b; 16 | 17 | 1 != 0; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/operators_after.move: -------------------------------------------------------------------------------- 1 | script { 2 | const A: u64 = 3 | 1; 4 | 5 | fun main() { 6 | let a = 1; 7 | let b = 1 + 2 + 3 + 4; 8 | let c = a == b; 9 | let d = 10 | 4; 11 | e = 12 | 5; 13 | 14 | *b; 15 | *&b; 16 | *&*&*&b; 17 | 18 | 1 != 0; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/specs.move: -------------------------------------------------------------------------------- 1 | module M { 2 | spec initialize { 3 | assert true; 4 | 5 | pragma hello = world, 6 | hello2 = world2; 7 | include 8 | MySchema; 9 | 10 | /// After genesis, time progresses monotonically. 11 | invariant update 12 | old(is_operating()) ==> old(spec_now_microseconds()) <= spec_now_microseconds(); 13 | 14 | /// Conditions we only check for the implementation, but do not pass to the caller. 15 | aborts_if [concrete] 16 | (if (proposer == @vm_reserved) { 17 | now != timestamp 18 | } else { 19 | now >= timestamp 20 | }) 21 | with error::INVALID_ARGUMENT; 22 | } 23 | 24 | spec MyStruct { 25 | assert true; 26 | } 27 | 28 | spec schema MySchema { 29 | assert true; 30 | } 31 | 32 | spec module { 33 | fun is_currency(): bool { 34 | true 35 | } 36 | } 37 | 38 | spec fun spec_is_lbr(): bool { 39 | type() == type(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/structs.move: -------------------------------------------------------------------------------- 1 | module M { 2 | struct MyStruct { 3 | a: u8, 4 | b: u8, 5 | c: u8, 6 | } 7 | 8 | resource struct MyStruct { 9 | a: u8, 10 | b: u8, 11 | c: u8, 12 | } 13 | } 14 | 15 | module M2 { 16 | struct MyStruct { 17 | a:u8, 18 | b : u8 , c:u8, 19 | } 20 | 21 | fun main() { 22 | call(MyStruct { 23 | a: val, b: anotherval 24 | }); 25 | 26 | call( 27 | a, 28 | MyStruct { 29 | a: val, b: anotherval 30 | } 31 | ); 32 | 33 | let a = MyStruct{val}; 34 | let a = MyStruct{val:myval}; 35 | let a = MyStruct{val:myval}; 36 | 37 | let MyStruct{val} = get_struct(); 38 | let MyStruct{val:myval} = get_struct(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/formatter.fixtures/structs_after.move: -------------------------------------------------------------------------------- 1 | module M { 2 | struct MyStruct { 3 | a: u8, 4 | b: u8, 5 | c: u8, 6 | } 7 | 8 | resource struct MyStruct { 9 | a: u8, 10 | b: u8, 11 | c: u8, 12 | } 13 | } 14 | 15 | module M2 { 16 | struct MyStruct { 17 | a: u8, 18 | b: u8, 19 | c: u8, 20 | } 21 | 22 | fun main() { 23 | call(MyStruct { 24 | a: val, b: anotherval 25 | }); 26 | 27 | call( 28 | a, 29 | MyStruct { 30 | a: val, b: anotherval 31 | } 32 | ); 33 | 34 | let a = MyStruct { val }; 35 | let a = MyStruct { val: myval }; 36 | let a = MyStruct { val: myval }; 37 | 38 | let MyStruct { val } = get_struct(); 39 | let MyStruct { val: myval } = get_struct(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/typing/lineComment.fixtures/after_outer_doc_comment.move: -------------------------------------------------------------------------------- 1 | /// multiply by two 2 | module 0x1::M {} 3 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/ide/typing/lineComment.fixtures/after_outer_doc_comment_after.move: -------------------------------------------------------------------------------- 1 | /// multiply by two 2 | /// 3 | module 0x1::M {} 4 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/lexer/block_comments.move: -------------------------------------------------------------------------------- 1 | /* module M */ 2 | module M1 {} 3 | 4 | /* /* */ */ 5 | module M2 {} 6 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/lexer/block_comments.txt: -------------------------------------------------------------------------------- 1 | BLOCK_COMMENT ('/* module M */') 2 | WHITE_SPACE ('\n') 3 | module ('module') 4 | WHITE_SPACE (' ') 5 | IDENTIFIER ('M1') 6 | WHITE_SPACE (' ') 7 | { ('{') 8 | } ('}') 9 | WHITE_SPACE ('\n\n') 10 | BLOCK_COMMENT ('/* /* */ */') 11 | WHITE_SPACE ('\n') 12 | module ('module') 13 | WHITE_SPACE (' ') 14 | IDENTIFIER ('M2') 15 | WHITE_SPACE (' ') 16 | { ('{') 17 | } ('}') 18 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/access_control.move: -------------------------------------------------------------------------------- 1 | module 0x1::access_control { 2 | fun f1(): u8 acquires S {} 3 | 4 | fun f2(): u8 reads S {} 5 | 6 | fun f3(): u8 writes S {} 7 | 8 | fun f4() acquires S(*) {} 9 | 10 | fun f_multiple() acquires R reads R writes T, S reads G {} 11 | 12 | fun f5() acquires 0x42::*::* {} 13 | 14 | fun f6() acquires 0x42::m::* {} 15 | 16 | fun f7() acquires *(*) {} 17 | 18 | fun f8() acquires *(0x42) {} 19 | 20 | fun f9(a: address) acquires *(a) {} 21 | 22 | fun f10(param: u64) acquires *(make_up_address(param)) {} 23 | 24 | fun make_up_address(x: u64): address { 25 | @0x42 26 | } 27 | 28 | fun f11() !reads *(0x42), *(0x43) {} 29 | 30 | fun f12() pure {} 31 | 32 | fun ok2(s: &signer): bool reads R(signer::address_of(s)) {} 33 | 34 | fun ok2(s: &signer): bool reads R(address_of(s)) {} 35 | } 36 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/addresses.move: -------------------------------------------------------------------------------- 1 | address named = 0x1; 2 | address alice = {{alice}}; 3 | 4 | /* my module */ 5 | module 0x1::M { 6 | fun main() { 7 | @0; 8 | @01; 9 | @0x0; 10 | @0x0000; 11 | @0x00001111; 12 | @wallet1pxqfjvnu0utauj8fctw2s7j4mfyvrsjd59c2u8; 13 | @5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty; 14 | @Std; 15 | @{{alice}}; 16 | @DiemFramework; 17 | 18 | @0x89b9f9d1fadc027cf9532d6f9904152222331122; 19 | @0x89b9f9d1fadc027cf9532d6f9904152289b9f9d1fadc027cf9532d6f99041522; 20 | } 21 | } 22 | 23 | address 0x111 { 24 | module M {} 25 | } 26 | 27 | address wallet1pxqfjvnu0utauj8fctw2s7j4mfyvrsjd59c2u8 { 28 | module M {} 29 | } 30 | 31 | address 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty { 32 | module M {} 33 | } 34 | 35 | address DiemFramework { 36 | module M1 { 37 | 38 | } 39 | } 40 | 41 | module 0x111::M2 {} 42 | module DiemFramework::M2 {} 43 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/annotated_literals.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | (0x1: u128); 4 | (0x1u128: u128); 5 | (000001: u128); 6 | (0: u64); 7 | (10000: u64); 8 | (true: bool); 9 | (false: bool); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/assignments.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | *a = 3; 4 | record.val = 1; 5 | record.val = vector>>; 6 | (record.val = 1); 7 | 8 | call().operator = 11; 9 | call().operator.main = 11; 10 | 11 | Coin { value: val } = 1; 12 | Coin { value: _ } = 1; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/comments.move: -------------------------------------------------------------------------------- 1 | // line comment 2 | script { 3 | /* block comment */ 4 | /** 5 | multiline comment 6 | */ 7 | /** 8 | * One can have /* nested */ 9 | * // block comments 10 | */ 11 | fun main() {} 12 | // /* unclosed block comment inside line comment 13 | // /* block comment inside line comment */ 14 | } 15 | 16 | /// doc comment 17 | /// another doc comment 18 | module 0x1::M { 19 | /// function doc comment 20 | fun m() {} 21 | /// doc comment with outer attribute 22 | #[test_only] 23 | fun main() { 24 | let _ = /*caret*/1; 25 | } 26 | 27 | /// docs 28 | native fun native_m(); 29 | 30 | /// docs 31 | native struct NatS; 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/contextual_token_operators.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | 1 < 2; 4 | 1 > 2; 5 | 1 << 2; 6 | 1 >> 2; 7 | 1 && 2; 8 | 1 || 2; 9 | 1 <= 2; 10 | 1 >= 2; 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/dot_expressions.move: -------------------------------------------------------------------------------- 1 | module 0x1::dot_expressions { 2 | fun dot() { 3 | bin.field1.field2; 4 | bin.field < 1; 5 | bin.receiver_func(); 6 | bin.field.call(); 7 | 8 | bin.call::(); 9 | bin.call::(); 10 | vector[1].length::(); 11 | } 12 | spec dot { 13 | bin.field[1]; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/expressions.move: -------------------------------------------------------------------------------- 1 | module M { 2 | fun main() { 3 | 1; 1u8; 1u16; 1u32; 1u64; 1u128; 4 | 5 | 0b11; // invalid 6 | 0xFF; 7 | 0x; 8 | 0011; 9 | 0xRR; // invalid 10 | 0xFFFu128; 11 | 12 | 0x1111_1111; 13 | 1_000; 14 | 15 | (1 + 1) * (1 + 1); 16 | (!!true + !!true) * !!false; 17 | 1 % 2; 18 | 1 ^ 2; 19 | 20 | (a * b as u64); 21 | 22 | *a = 1 + 2 * (3 + 5) * 4; 23 | 24 | a < b && b > 2; 25 | 26 | v1[1+1]; 27 | v2[i + 1..len(v2)]; 28 | 29 | has; 30 | schema; 31 | include; 32 | assume; 33 | assert; 34 | invariant; 35 | 36 | return 37 | } 38 | fun m() { 39 | return 1 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/expressions_angle_brackets.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | a < b && b > 2; 4 | a <= b && b > 2; 5 | 6 | a <= b < 1 >= 2 > 3; 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/expressions_assignments.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | let a = 1 + 1; 4 | let b = (a = 1); 5 | 6 | *&a = 1; 7 | &a.b = 1; 8 | *a = *1 + *1; 9 | *a = *1 * *1; 10 | *a = *!1 + *!2; 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/expressions_if_else_as.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | if (true) *!1 else *!2; 4 | (if (true) 1 else 2) as u8; 5 | (2) as u8; 6 | (a = 2) as u8; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/expressions_specs.move: -------------------------------------------------------------------------------- 1 | module M { 2 | spec module { 3 | a ==> b; 4 | a <==> b; 5 | a < x && y ==> x; 6 | a <= x && y <==> x; 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/friend.move: -------------------------------------------------------------------------------- 1 | module M1 { 2 | friend 0x1::M2; 3 | 4 | #[test_only] 5 | friend 0x2::M2; 6 | 7 | public(friend) fun f_of_m1() {} 8 | public ( friend ) fun f_of_m2() {} 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/function_calls.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | call(); 4 | call(1, 2); 5 | call(b"", b""); 6 | call(b"", x""); 7 | call(x"", b""); 8 | call(x"", x""); 9 | call(1, 2,); 10 | call(0, 0u8, 0u64, 1u8, 1u64,); 11 | call(a, a.b, &a, &mut a, copy a, move a); 12 | 13 | call(); 14 | call<0x1::Mod::S>(); 15 | call(); 16 | call(); 17 | call>(); 18 | call>(Transaction::new>()); 19 | 20 | Transaction::call>(); 21 | 22 | assert(true, 1); 23 | assert!(true, 1); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/generics.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | let a = vector; 4 | let b = map; 5 | let c = vector>; 6 | let c = map>; 7 | 8 | vector == vector; 9 | vector >= vector; 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/let_patterns.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | let a = 1; 4 | let (a, b) = (1, 2); 5 | let R { a, b } = get_record(); 6 | let R { a: _, b: _ } = get_record(); 7 | 8 | let R { a: alias_a, b: alias_b } = get_record(); 9 | let R { a: T { c, d }} = get_record(); 10 | let R { a: T { c: alias_c, d: _ }} = get_record(); 11 | 12 | let (R { a, b }, M { a: _, b: _ }) = get_record_tuple(); 13 | 14 | let Generic {} = g; 15 | let Generic { g } = g; 16 | let Generic { g: R { f: f3 } } = g; 17 | 18 | let a: (u8) = 1; 19 | let a: (((u8))) = 1; 20 | let b: ((u8, u8)) = (1, 1); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/loops.move: -------------------------------------------------------------------------------- 1 | module 0x1::loops { 2 | fun main() { 3 | while (true) { 4 | 1; 5 | break; 6 | continue; 7 | }; 8 | loop { 9 | 1; 10 | break; 11 | continue; 12 | }; 13 | 14 | let for; 15 | for (i in 0..10) { 16 | 1; 17 | break; 18 | continue; 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/macros.move: -------------------------------------------------------------------------------- 1 | module 0x1::macros { 2 | public inline fun map( 3 | v: vector, 4 | f: |Element|NewElement, 5 | ): vector { 6 | foreach(v, |elem| push_back(&mut result, f(elem))); 7 | } 8 | 9 | inline fun filter( 10 | p: |&Element| 11 | ) { 12 | foreach(v, |elem| { 13 | if (p(&elem)) push_back(&mut result, elem); 14 | }); 15 | } 16 | 17 | inline fun fold(a: (Element), 18 | f: (|Element| Element), 19 | g: |Element, (|Element| Element)| Element): Element { 20 | f(a, g) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/public_package.move: -------------------------------------------------------------------------------- 1 | module 0x1::public_package { 2 | 3 | public(package) fun package(package: u8): u8 { 4 | let package = package + 1; 5 | package 6 | } 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/strings.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | b"(false: bool);"; 4 | x"0101"; 5 | x""; 6 | b"\t\n\r\0"; 7 | b"\\"; 8 | b"\""; 9 | b"\x01"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/struct_declarations.move: -------------------------------------------------------------------------------- 1 | module 0x1::M { 2 | struct Coin {} 3 | 4 | struct ValidatorConfig has store, drop { 5 | val1: u8, 6 | val2: vector, 7 | } 8 | 9 | struct ResourceValidatorConfig { 10 | val1: u8, 11 | val2: vector, 12 | operator_account: Option
, 13 | operator_account2: Option<&signer>, 14 | } 15 | 16 | native struct NativeStruct; 17 | 18 | native struct NativeStructParams; 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/struct_literals.move: -------------------------------------------------------------------------------- 1 | module M { 2 | fun main() { 3 | let a = Struct { a: val, b: 1 + 1 }; 4 | let a = Struct { a: val, b: Struct2 { val, anotherval: 1 + 1 } }; 5 | } 6 | 7 | fun return_empty_struct() { 8 | return Struct {}; 9 | } 10 | 11 | fun return_empty_struct_as_expression() { 12 | Struct {} 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/use.move: -------------------------------------------------------------------------------- 1 | script { 2 | use 0x1::Transaction; 3 | use 0x1::Transaction::Instance; 4 | use 0x1::Transaction::{}; 5 | use 0x1::Transaction::{Self, EventHandle}; 6 | use 0x1::Transaction::foo as bar; 7 | use 0x1::Transaction::{foo, foo as bar}; 8 | 9 | fun main() { 10 | use 0x1::Transaction; 11 | 12 | let x = { 13 | use 0x1::Transaction; 14 | 0 15 | }; 16 | 17 | {{{{ 18 | use 0x2::Mango; 19 | }}}}; 20 | 21 | while (true) { 22 | use 0x1::Transaction; 23 | }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/vectors.move: -------------------------------------------------------------------------------- 1 | module 0x1::vectors { 2 | use std::vector; 3 | 4 | fun main(a: vector) { 5 | vector[]; 6 | vector[1, 1]; 7 | vector[ 8 | type_info, 9 | type_info, 10 | ]; 11 | vector[1, 2, 3]; 12 | vector::add(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/complete/while_loop_inline_assignment.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | while (v < 10) v = v + 1; 4 | while (v < 10) { v = v + 1 }; 5 | while (v < 10) ( v = v + 1 ); 6 | while (v < 10) ( v: u8 ); 7 | while (v < 10) ( (v = v + 1): u8 ); 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/assignments.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | let a = ; 4 | let a: = 1; 5 | let a: u8 1; 6 | 7 | call() 8 | let (a, b) = ; 9 | let (a +++ ) = 1; 10 | 11 | *a = ; 12 | 13 | let R { a = ; 14 | let R { a; 15 | let R { a, b } = ; 16 | 17 | record.val = ; 18 | (record.val = ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/dot_exprs.move: -------------------------------------------------------------------------------- 1 | module 0x1::dot_exprs { 2 | fun m() { 3 | bin. assert!(true, 1); 4 | 5 | bin. S { field: 1 }; 6 | 7 | bin. vector[]; 8 | 9 | bin.field bin.field 10 | 11 | bin. aptos_token::get_token(); 12 | 13 | bin. b" 14 | bin. x" 15 | bin. return 16 | } 17 | 18 | fun receiver() { 19 | bin.no_type_args_without_colon_colon(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/empty_script.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun 3 | } 4 | 5 | script { 6 | fun main(); 7 | } 8 | 9 | script { 10 | fun main 11 | fun main 12 | } -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/expressions.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun m() { 3 | bin.; 4 | x"; 5 | b" 6 | } 7 | fun main() { 8 | RMRK 9 | RMRK:: 10 | 0x1:: ; 11 | 0x1::RMRK:: ; 12 | Sender::RMRK:: ; 13 | Sender::RMRK:: 14 | 15 | while (true) {} 16 | return 17 | 0hello 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/function_calls.move: -------------------------------------------------------------------------------- 1 | script { 2 | fun main() { 3 | call(1; 4 | call(1 +); 5 | call(1, 2 +); 6 | call(1, 2,,); 7 | call(1, 2,,4); 8 | assert() 9 | 10 | foo4(1,; 11 | foo5(; 12 | 13 | foo6(1, 14 | let _ = 0; 15 | 16 | foo7(1, assert; 17 | 18 | let a = call(,); 19 | call(& ); 20 | call(&mut ); 21 | 22 | call10(,,,); 23 | 24 | assert!(s.val +); 25 | assert!(s.val !=); 26 | assert!(s.val ==); 27 | 28 | spec { 29 | call(a, 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/function_signatures.move: -------------------------------------------------------------------------------- 1 | module M { 2 | fun main(a,) {} 3 | fun main(a: u8, b) {} 4 | fun main(a: u8, b:) {} 5 | 6 | pub 7 | public 8 | public(friend) 9 | public(script) 10 | public fun 11 | 12 | native 13 | native fun 14 | native public 15 | native public(friend) 16 | native public(script) 17 | native public fun 18 | 19 | fun main_01(a b: u8) {} 20 | fun main_02(, b: u8) {} 21 | fun main_03(a: &, b: u8) {} 22 | 23 | fun main_1(): (u8 {} 24 | fun main_2(): (u8, {} 25 | fun main_3(): (u8, u8 {} 26 | fun main_5() acq 27 | fun main_6() acquires {} 28 | fun main_7() acquires U,,{} 29 | fun main_8() acquires U V{} 30 | 31 | fun main_11<() {} 32 | fun main_12() {} 35 | fun main_15() {} 36 | } 37 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/module_const.move: -------------------------------------------------------------------------------- 1 | module M { 2 | const MY_CONST 3 | 4 | const MY_CONST: 5 | 6 | const MY_CONST: u8 7 | 8 | const MY_CONST: u8 = 9 | 10 | const MY_CONST: u8 = 1 11 | 12 | const CONST_NO_TYPE = 1; 13 | 14 | const CONST_NO_TYPE_WITH_COMMA: = 1; 15 | 16 | fun main() {} 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/module_uses.move: -------------------------------------------------------------------------------- 1 | module 0x1::M { 2 | use 3 | use 0x0 4 | use Std 5 | use Std:: 6 | use 0x0:: 7 | use 0x0::Transaction 8 | use 0x0::Transaction:: 9 | use 0x0::Transaction::; 10 | use 0x0::Transaction::create 11 | use 0x0::Transaction::{ 12 | use 0x0::Transaction::{; 13 | use 0x0::Transaction::{create, 14 | use 0x0::Transaction::{create,; 15 | use 0x0::Transaction::{create, modify,,} 16 | use 0x0::Transaction::{create as , update}; 17 | 18 | fun main() {} 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/spec.move: -------------------------------------------------------------------------------- 1 | module 0x1::M { 2 | spec 3 | spec my_function 4 | spec MyStruct 5 | spec module 6 | spec fun 7 | spec fun myfun 8 | spec schema 9 | spec schema MySchema 10 | 11 | fun m() { 12 | assume; 13 | let a = exists; 14 | 1 ==> 2; 15 | } 16 | spec module { 17 | include Schema 18 | 19 | assert; 20 | assume; 21 | assume exists 1; 22 | 23 | ensures result ==> 1; 24 | ensures true 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/struct_decls.move: -------------------------------------------------------------------------------- 1 | module 0x1::M { 2 | struct 3 | native struct 4 | struct S 5 | struct {} 6 | native struct S1 7 | struct S 8 | struct S 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/struct_fields.move: -------------------------------------------------------------------------------- 1 | module M { 2 | struct T { 3 | : u8, 4 | my_field: u8 5 | } 6 | struct T { 7 | my_field: , 8 | my_field: u8 9 | } 10 | struct T { 11 | my_field: u8 12 | my_field: u8 13 | } 14 | 15 | struct NoTypesFields { 16 | field1, 17 | field2:, 18 | field3 19 | } 20 | 21 | fun main() { 22 | let T { my: } = 1; 23 | let T { my: , my_field } = 1; 24 | let T { my: , my_field: , my_field2: _ } = 1; 25 | let T { my myfield } = 1; 26 | let T { my myfield: _ } = 1; 27 | } 28 | } 29 | 30 | module M { 31 | fun main() { 32 | T { my: }; 33 | T { my: , my_field: , my_field2: 2 }; 34 | T { my myfield: 1 }; 35 | T { my myfield }; 36 | T { my myfield: _ }; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/partial/top_level_items.move: -------------------------------------------------------------------------------- 1 | module 2 | module Std:: 3 | 4 | script { 5 | fun 6 | } 7 | 8 | script { 9 | fun main() 10 | } 11 | 12 | script { 13 | use 14 | fun main() {} 15 | } 16 | 17 | script { 18 | use 0x0:: 19 | } 20 | 21 | script { 22 | use 0x0:: 23 | 24 | fun main() { 25 | use 0x0:: 26 | } 27 | } 28 | 29 | script { 30 | use 0x0::Transaction:: 31 | 32 | fun main() {} 33 | } 34 | 35 | script { 36 | use 0x0::Transaction::create 37 | 38 | fun main() {} 39 | } 40 | 41 | script { 42 | use 0x0::Transaction::; 43 | 44 | fun main() {} 45 | } 46 | 47 | script { 48 | use 0x0::Transaction::create 49 | use 0x0::Transaction::modify; 50 | 51 | fun main() {} 52 | } 53 | 54 | /* 55 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/specs/apply.move: -------------------------------------------------------------------------------- 1 | module M { 2 | spec module { 3 | apply Foo to *foo; 4 | apply ExactlyOne to * except initialize; 5 | apply ModuleInvariant to *foo*; 6 | apply EnsuresHasKeyRotationCap { account: new_account } to make_account; 7 | apply ModuleInvariant to *foo*, bar except public *, internal baz; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/specs/forall_exists.move: -------------------------------------------------------------------------------- 1 | module 0x1::M { 2 | spec fun spec_call() { 3 | exists i in 1..100: i == 3 4 | } 5 | spec module { 6 | invariant 7 | forall addr1: address where old(exists(addr1)): true; 8 | 9 | invariant 10 | forall x: num, y: num, z: num 11 | : x == y && y == z ==> x == z; 12 | invariant 13 | forall x: num 14 | : exists y: num 15 | : y >= x; 16 | 17 | invariant 18 | forall x: num where true: 19 | forall y: num where false: 20 | x >= y; 21 | 22 | invariant exists x in 1..10, y in 8..12 : x == y; 23 | invariant exists x in 1..10, y in 8..12 : x == y; 24 | 25 | ensures result ==> (forall j in 0..100: true); 26 | ensures exists x in 1..10 : x == 1; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/specs/pragma.move: -------------------------------------------------------------------------------- 1 | module M { 2 | spec module { 3 | pragma verify; 4 | pragma verify = true; 5 | pragma verify = true, timeout; 6 | pragma verify = true, timeout = 60; 7 | pragma friend = gg; 8 | pragma friend = 0x1::m::gg; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/specs/scopes.move: -------------------------------------------------------------------------------- 1 | module M { 2 | fun main() { 3 | spec {}; 4 | spec {} 5 | } 6 | 7 | spec module { 8 | fun all(): bool {} 9 | fun uninterpreted(addr: address); 10 | 11 | // Native function which is defined in the prover's prelude. 12 | native fun serialize(v: &MvValue): vector; 13 | } 14 | 15 | spec MyStruct {} 16 | spec fun spec_is_valid(addr: address) {} 17 | spec fun spec_uninterpreted(addr: address); 18 | spec native fun spec_is_valid_native(addr: address); 19 | 20 | fun unpack() {} 21 | 22 | spec unpack {} 23 | spec unpack() {} 24 | spec unpack() {} 25 | spec unpack(a: u8, b: u8) {} 26 | spec unpack(): u8 {} 27 | 28 | spec schema ModuleInvariant { 29 | supply: num; 30 | local ensures: num; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/specs/spec_file.move: -------------------------------------------------------------------------------- 1 | spec sender::my_module { 2 | spec create_address { 3 | pragma opaque; 4 | } 5 | 6 | spec fun spec_now_microseconds(): u64 { 7 | global(@aptos_framework).microseconds 8 | } 9 | 10 | /// Helper schema to specify that a function aborts if not in genesis. 11 | spec schema AbortsIfNotGenesis { 12 | aborts_if !is_genesis() with error::INVALID_STATE; 13 | } 14 | 15 | spec write_to_event_store() { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/specs/spec_properties.move: -------------------------------------------------------------------------------- 1 | module 0x1::spec_properties { 2 | spec module { 3 | invariant [] true; 4 | invariant [seed = 1] true; 5 | invariant [abstract, concrete, verify = true] 1 == 1; 6 | invariant [seed] true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/org/sui/lang/parser/specs/spec_variables.move: -------------------------------------------------------------------------------- 1 | module 0x1::m { 2 | spec module { 3 | local two: u8; 4 | local two_with_params: u8; 5 | global three: u8; 6 | global four: u8 = 1; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ui-tests/src/main/kotlin/org/move/ui/utils/StepsLogger.kt: -------------------------------------------------------------------------------- 1 | // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. 2 | 3 | package org.sui.ui.utils 4 | 5 | import com.intellij.remoterobot.stepsProcessing.StepLogger 6 | import com.intellij.remoterobot.stepsProcessing.StepWorker 7 | 8 | object StepsLogger { 9 | private var initializaed = false 10 | 11 | @JvmStatic 12 | fun init() { 13 | if (initializaed.not()) { 14 | StepWorker.registerProcessor(StepLogger()) 15 | initializaed = true 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /ui-tests/src/test/resources/example-packages/aptos_package/Move.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "MyAptosPackage" 3 | version = "1.0.0" 4 | authors = [] 5 | 6 | [addresses] 7 | 8 | [dev-addresses] 9 | 10 | [dependencies.AptosFramework] 11 | git = "https://github.com/aptos-labs/aptos-core.git" 12 | rev = "mainnet" 13 | subdir = "aptos-move/framework/aptos-framework" 14 | 15 | [dev-dependencies] 16 | -------------------------------------------------------------------------------- /ui-tests/src/test/resources/example-packages/aptos_package/sources/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/ui-tests/src/test/resources/example-packages/aptos_package/sources/.gitkeep -------------------------------------------------------------------------------- /ui-tests/src/test/resources/example-packages/empty_move_package/main.move: -------------------------------------------------------------------------------- 1 | module 0x1::main { 2 | fun main() {} 3 | } 4 | -------------------------------------------------------------------------------- /ui-tests/src/test/resources/example-packages/sui_package/sources/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoh-zone/intellij-move/48845e020b80432b1cf58c2eb9192e5759b8a2c0/ui-tests/src/test/resources/example-packages/sui_package/sources/.gitkeep --------------------------------------------------------------------------------