diff --git a/src/main/kotlin/com/jetbrains/snakecharm/actions/SmkStatementMover.kt b/src/main/kotlin/com/jetbrains/snakecharm/actions/SmkStatementMover.kt index 7a12226f..cef07622 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/actions/SmkStatementMover.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/actions/SmkStatementMover.kt @@ -14,9 +14,9 @@ import com.intellij.psi.impl.source.PostprocessReformattingAspect import com.intellij.psi.util.PsiTreeUtil import com.jetbrains.python.codeInsight.editorActions.moveUpDown.PyStatementMover import com.jetbrains.python.psi.* -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.TOPLEVEL_ARGS_SECTION_KEYWORDS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.TOPLEVEL_ARGS_SECTION_KEYWORDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.psi.* open class SmkStatementMover : PyStatementMover() { @@ -73,7 +73,7 @@ open class SmkStatementMover : PyStatementMover() { elementToMove: PsiElement, down: Boolean ): LineRange? { - val api = SnakemakeAPIProjectService.getInstance(elementToMove.project) + val api = SnakemakeApiService.getInstance(elementToMove.project) val document = file.viewProvider.document ?: return null val offset = if (down) elementToMove.textRange.endOffset else elementToMove.textRange.startOffset @@ -129,20 +129,20 @@ open class SmkStatementMover : PyStatementMover() { private fun isNotAvailableForMoveInto( elementToMove: PsiElement, destination: PsiElement?, - api: SnakemakeAPIProjectService + api: SnakemakeApiService ): Boolean { return (elementToMove is SmkSection && elementToMove !is SmkRunSection && ((destination is SmkRuleOrCheckpoint && elementToMove.sectionKeyword !in api.getRuleOrCheckpointArgsSectionKeywords()) || (destination is SmkSubworkflow && - elementToMove.sectionKeyword !in SnakemakeAPI.SUBWORKFLOW_SECTIONS_KEYWORDS) || + elementToMove.sectionKeyword !in SnakemakeApi.SUBWORKFLOW_SECTIONS_KEYWORDS) || (destination is SmkModule && elementToMove.sectionKeyword !in api.getModuleSectionKeywords()) || (destination is SmkUse && elementToMove.sectionKeyword !in api.getUseSectionKeywords()))) } - private fun isAvailableForMoveOut(elementToMove: PsiElement, down: Boolean, api: SnakemakeAPIProjectService): Boolean { + private fun isAvailableForMoveOut(elementToMove: PsiElement, down: Boolean, api: SnakemakeApiService): Boolean { val useSectionsKeywords = api.getUseSectionKeywords() val statementList = getStatementList(elementToMove) ?: return true @@ -234,7 +234,7 @@ open class SmkStatementMover : PyStatementMover() { /** * modified version */ - private fun moveOut(elementToMove: PsiElement, editor: Editor, down: Boolean, api: SnakemakeAPIProjectService): ScopeRange? { + private fun moveOut(elementToMove: PsiElement, editor: Editor, down: Boolean, api: SnakemakeApiService): ScopeRange? { val statementList = getStatementList(elementToMove) ?: return null val statements = statementList.statements @@ -281,7 +281,7 @@ open class SmkStatementMover : PyStatementMover() { down: Boolean, statements: Array, clazz: Class, - api: SnakemakeAPIProjectService + api: SnakemakeApiService ): ScopeRange? { val useSectionsKeywords = api.getUseSectionKeywords() diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/ImplicitPySymbolsProvider.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SmkImplicitPySymbolsProvider.kt similarity index 97% rename from src/main/kotlin/com/jetbrains/snakecharm/codeInsight/ImplicitPySymbolsProvider.kt rename to src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SmkImplicitPySymbolsProvider.kt index 15c6a48b..6283107c 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/ImplicitPySymbolsProvider.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SmkImplicitPySymbolsProvider.kt @@ -30,8 +30,8 @@ import com.jetbrains.python.psi.resolve.fromSdk import com.jetbrains.python.psi.resolve.resolveQualifiedName import com.jetbrains.python.psi.types.TypeEvalContext import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SECTION_ACCESSOR_CLASSES -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_API_VERS_6_1 +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SECTION_ACCESSOR_CLASSES +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_API_VERS_6_1 import com.jetbrains.snakecharm.codeInsight.completion.SmkCompletionUtil import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings import com.jetbrains.snakecharm.framework.SmkSupportProjectSettingsListener @@ -44,7 +44,7 @@ import javax.swing.SwingUtilities * @date 2019-05-07 */ @Suppress("UnstableApiUsage") -class ImplicitPySymbolsProvider( +class SmkImplicitPySymbolsProvider( val project: Project, ) : Disposable { @@ -232,11 +232,11 @@ class ImplicitPySymbolsProvider( val packages = PythonPackageManager.forSdk(project, sdk).installedPackages - val pkgSnakemake = packages.firstOrNull { it.name == SnakemakeAPI.SMK_API_PKG_NAME_SMK } + val pkgSnakemake = packages.firstOrNull { it.name == SnakemakeApi.SMK_API_PKG_NAME_SMK } if (pkgSnakemake != null) { return PyPackage(pkgSnakemake.name, pkgSnakemake.version).matches(requirementSnakemake) } - val pkgSnakemakeMinimal = packages.firstOrNull { it.name == SnakemakeAPI.SMK_API_PKG_NAME_SMK_MINIMAL } + val pkgSnakemakeMinimal = packages.firstOrNull { it.name == SnakemakeApi.SMK_API_PKG_NAME_SMK_MINIMAL } if (pkgSnakemakeMinimal != null) { return PyPackage(pkgSnakemakeMinimal.name, pkgSnakemakeMinimal.version).matches(requirementSnakemakeMinimal) } @@ -648,11 +648,11 @@ class ImplicitPySymbolsProvider( usedFiles.add(commonFile.virtualFile) } - globals[SnakemakeAPI.SMK_VARS_CHECKPOINTS] = commonFile?.findTopLevelClass("Checkpoints") - globals[SnakemakeAPI.SMK_VARS_RULES] = commonFile?.findTopLevelClass("Rules") - globals[SnakemakeAPI.SMK_VARS_SCATTER] = commonFile?.findTopLevelClass("Scatter") - globals[SnakemakeAPI.SMK_VARS_GATHER] = commonFile?.findTopLevelClass("Gather") - globals[SnakemakeAPI.SMK_VARS_CONFIG] = null + globals[SnakemakeApi.SMK_VARS_CHECKPOINTS] = commonFile?.findTopLevelClass("Checkpoints") + globals[SnakemakeApi.SMK_VARS_RULES] = commonFile?.findTopLevelClass("Rules") + globals[SnakemakeApi.SMK_VARS_SCATTER] = commonFile?.findTopLevelClass("Scatter") + globals[SnakemakeApi.SMK_VARS_GATHER] = commonFile?.findTopLevelClass("Gather") + globals[SnakemakeApi.SMK_VARS_CONFIG] = null val checkpointsFile = collectPyFiles("snakemake.checkpoints", usedFiles, sdk).firstOrNull() if (checkpointsFile != null) { @@ -684,7 +684,7 @@ class ImplicitPySymbolsProvider( elementsCache.add( SmkCodeInsightScope.TOP_LEVEL to SmkCompletionUtil.createPrioritizedLookupElement( - SnakemakeAPI.SMK_VARS_PEP, + SnakemakeApi.SMK_VARS_PEP, pepObjectConstructor, typeText = SnakemakeBundle.message("TYPES.rule.run.workflow.globals.type.text"), priority = SmkCompletionUtil.WORKFLOW_GLOBALS_PRIORITY @@ -693,8 +693,8 @@ class ImplicitPySymbolsProvider( } companion object { - private val LOG = logger() // TODO: cleanup - fun instance(project: Project) = project.service() + private val LOG = logger() // TODO: cleanup + fun instance(project: Project) = project.service() } override fun dispose() { @@ -727,7 +727,7 @@ private class ImplicitPySymbolsCacheImpl( private fun validElements(elements: List): List { val validElements = elements.filter { it.psiDeclaration.isValid } if (validElements.size != elements.size) { - project.service().scheduleUpdate() + project.service().scheduleUpdate() } return validElements } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SmkTypeProvider.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SmkTypeProvider.kt index d638152c..e15fe065 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SmkTypeProvider.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SmkTypeProvider.kt @@ -11,12 +11,12 @@ import com.jetbrains.python.psi.resolve.resolveQualifiedName import com.jetbrains.python.psi.types.PyType import com.jetbrains.python.psi.types.PyTypeProviderBase import com.jetbrains.python.psi.types.TypeEvalContext -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SECTION_ACCESSOR_CLASSES -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_VARS_CHECKPOINTS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_VARS_PEP -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_VARS_RULES -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_VARS_WILDCARDS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.WILDCARDS_ACCESSOR_CLASS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SECTION_ACCESSOR_CLASSES +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_VARS_CHECKPOINTS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_VARS_PEP +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_VARS_RULES +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_VARS_WILDCARDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.WILDCARDS_ACCESSOR_CLASS import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings import com.jetbrains.snakecharm.lang.SnakemakeLanguageDialect import com.jetbrains.snakecharm.lang.psi.* @@ -110,7 +110,7 @@ class SmkTypeProvider : PyTypeProviderBase() { lambda, SmkRuleOrCheckpointArgsSection::class.java, PyCallExpression::class.java ) ?: return null - val apiService = SnakemakeAPIProjectService.getInstance(lambda.project) + val apiService = SnakemakeApiService.getInstance(lambda.project) val allowedArgs = apiService.getLambdaArgsForSubsection( parentSection.sectionKeyword, ruleLike.sectionKeyword ) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SnakemakeAPI.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SnakemakeApi.kt similarity index 90% rename from src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SnakemakeAPI.kt rename to src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SnakemakeApi.kt index 73d104f6..d0fd5087 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SnakemakeAPI.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SnakemakeApi.kt @@ -4,13 +4,13 @@ import com.intellij.openapi.Disposable import com.intellij.openapi.components.Service import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_VARS_WILDCARDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_VARS_WILDCARDS import com.jetbrains.snakecharm.framework.SmkAPISubsectionContextAndDirective import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings import com.jetbrains.snakecharm.framework.SmkSupportProjectSettingsListener -import com.jetbrains.snakecharm.framework.SnakemakeFrameworkAPIProvider -import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkAPIAnnParsingContextType -import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkKeywordDeprecationParams +import com.jetbrains.snakecharm.framework.SnakemakeApiYamlAnnotationsService +import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkApiAnnotationKeywordDeprecationParams +import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkApiAnnotationParsingContextType import com.jetbrains.snakecharm.lang.SmkLanguageVersion import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.SnakemakeNames.MODULE_CONFIG_KEYWORD @@ -50,9 +50,9 @@ import kotlinx.collections.immutable.toImmutableMap import kotlinx.collections.immutable.toImmutableSet /** - * Also see [ImplicitPySymbolsProvider] class + * Also see [SmkImplicitPySymbolsProvider] class */ -object SnakemakeAPI { +object SnakemakeApi { const val UNPACK_FUNCTION = "unpack" const val SMK_VARS_CONFIG = "config" @@ -71,7 +71,7 @@ object SnakemakeAPI { const val WILDCARDS_ACCESSOR_CLASS = "snakemake.io.Wildcards" /** - * Also see [ImplicitPySymbolsProvider], it also processes 'InputFiles', etc. symbols + * Also see [SmkImplicitPySymbolsProvider], it also processes 'InputFiles', etc. symbols */ val SECTION_ACCESSOR_CLASSES = mapOf( "snakemake.io.InputFiles" to "input", @@ -81,23 +81,8 @@ object SnakemakeAPI { "snakemake.io.Resources" to "resources" ) - /** - * Sections that execute external script with access to 'snakemake' object, i.e to 'snakemake.input', - * 'snakemake.params' etc settings. So we cannot verify that log section mentioned in rule is - * unused. - */ - val EXECUTION_SECTIONS_THAT_ACCEPTS_SNAKEMAKE_PARAMS_OBJ_FROM_RULE = setOf( - SECTION_WRAPPER, SECTION_NOTEBOOK, SECTION_SCRIPT, SECTION_CWL, - SECTION_TEMPLATE_ENGINE - ) - - val EXECUTION_SECTIONS_KEYWORDS = setOf( - SECTION_SHELL, - *EXECUTION_SECTIONS_THAT_ACCEPTS_SNAKEMAKE_PARAMS_OBJ_FROM_RULE.toTypedArray() - ) - // List of top-level sections - // XXX: cannot move to SnakemakeAPIProjectService because it is used to create Lexer, Parser, WordScanner, Highlighter + // XXX: cannot move to SnakemakeApiService because it is used to create Lexer, Parser, WordScanner, Highlighter // and not everywhere we could pass project instance val TOPLEVEL_ARGS_SECTION_KEYWORDS = setOf( WORKFLOW_CONFIGFILE_KEYWORD, @@ -168,8 +153,8 @@ object SnakemakeAPI { } @Service(Service.Level.PROJECT) -class SnakemakeAPIProjectService(val project: Project): Disposable { - private var state: SnakemakeAPIProjectState = SnakemakeAPIProjectState.EMPTY +class SnakemakeApiService(val project: Project): Disposable { + private var state: SnakemakeApiStateForLangLevel = SnakemakeApiStateForLangLevel.EMPTY /** * Checks if a given keyword requires only one argument @@ -179,8 +164,8 @@ class SnakemakeAPIProjectService(val project: Project): Disposable { * @return `true` if the keyword is a single argument section keyword within the given context, otherwise `false`. */ fun isSubsectionSingleArgumentOnly(keyword: String, contextKeywordOrType: String): Boolean { - val list = if (contextKeywordOrType == SmkAPIAnnParsingContextType.TOP_LEVEL.typeStr) { - state.contextType2SingleArgSectionKeywords[SmkAPIAnnParsingContextType.TOP_LEVEL.typeStr] + val list = if (contextKeywordOrType == SmkApiAnnotationParsingContextType.TOP_LEVEL.typeStr) { + state.contextType2SingleArgSectionKeywords[SmkApiAnnotationParsingContextType.TOP_LEVEL.typeStr] } else { state.contextType2SingleArgSectionKeywords[contextKeywordOrType] } @@ -195,8 +180,8 @@ class SnakemakeAPIProjectService(val project: Project): Disposable { * @return A Boolean indicating whether the given section only allows positional arguments. */ fun isSubsectionWithOnlyPositionalArguments(keyword: String, contextKeywordOrType: String): Boolean { - val list = if (contextKeywordOrType == SmkAPIAnnParsingContextType.TOP_LEVEL.typeStr) { - state.contextType2PositionalOnlySectionKeywords[SmkAPIAnnParsingContextType.TOP_LEVEL.typeStr] + val list = if (contextKeywordOrType == SmkApiAnnotationParsingContextType.TOP_LEVEL.typeStr) { + state.contextType2PositionalOnlySectionKeywords[SmkApiAnnotationParsingContextType.TOP_LEVEL.typeStr] } else { state.contextType2PositionalOnlySectionKeywords[contextKeywordOrType] } @@ -206,7 +191,7 @@ class SnakemakeAPIProjectService(val project: Project): Disposable { @Suppress("unused") fun isTopLevelArgsSectionKeyword(keyword: String): Boolean { // XXX: Used in parsing/lexing, cannot collect from YAML file - return keyword in SnakemakeAPI.TOPLEVEL_ARGS_SECTION_KEYWORDS + return keyword in SnakemakeApi.TOPLEVEL_ARGS_SECTION_KEYWORDS } fun isTopLevelKeyword(keyword: String): Boolean { @@ -227,8 +212,8 @@ class SnakemakeAPIProjectService(val project: Project): Disposable { fun isFunctionShortNameValidForInjection(shortName: String) = shortName in state.funShortNamesValidForInjection fun isSubsectionValidForInjection(keyword: String, contextKeywordOrType: String): Boolean { - require(contextKeywordOrType != SmkAPIAnnParsingContextType.FUNCTION.typeStr) - require(contextKeywordOrType != SmkAPIAnnParsingContextType.TOP_LEVEL.typeStr) + require(contextKeywordOrType != SmkApiAnnotationParsingContextType.FUNCTION.typeStr) + require(contextKeywordOrType != SmkApiAnnotationParsingContextType.TOP_LEVEL.typeStr) val keywords = state.contextType2NotValidForInjectionSubsectionKeywords[contextKeywordOrType] // our default is to allow injection in all sections => if section not registered, or event context type => true @@ -249,12 +234,12 @@ class SnakemakeAPIProjectService(val project: Project): Disposable { return state.funFqnToSectionRestrictionList[fqn] ?: emptyArray() } - fun getFunctionDeprecationByFqn(fqn: String): Pair? { + fun getFunctionDeprecationByFqn(fqn: String): Pair? { val entry = state.functionDeprecationsByFqn[fqn] return if (entry == null) null else (entry.key to entry.value) } - fun getFunctionDeprecationByShortName(fqn: String): Pair? { + fun getFunctionDeprecationByShortName(fqn: String): Pair? { val entry = state.functionDeprecationsByShortName[fqn] return if (entry == null) null else (entry.key to entry.value) } @@ -343,24 +328,24 @@ class SnakemakeAPIProjectService(val project: Project): Disposable { MODULE_SKIP_VALIDATION_KEYWORD, MODULE_META_WRAPPER_KEYWORD, MODULE_REPLACE_PREFIX_KEYWORD - ) + SnakemakeFrameworkAPIProvider.getInstance() + ) + SnakemakeApiYamlAnnotationsService.getInstance() .collectAllPossibleModuleSubsectionKeywords() return MODULE_SECTIONS_KEYWORDS } fun getRuleOrCheckpointArgsSectionKeywords(): Set { - val RULE_OR_CHECKPOINT_ARGS_SECTION_KEYWORDS = SnakemakeFrameworkAPIProvider.getInstance() + val RULE_OR_CHECKPOINT_ARGS_SECTION_KEYWORDS = SnakemakeApiYamlAnnotationsService.getInstance() .collectAllPossibleRuleOrCheckpointSubsectionKeywords() return RULE_OR_CHECKPOINT_ARGS_SECTION_KEYWORDS } - fun getRuleOrCheckpointSectionKeywords(): Set { + fun getRuleOrCheckpointAllSectionTypesKeywords(): Set { val RULE_OR_CHECKPOINT_SECTION_KEYWORDS = (getRuleOrCheckpointArgsSectionKeywords() + setOf(SECTION_RUN)) return RULE_OR_CHECKPOINT_SECTION_KEYWORDS } fun getUseSectionKeywords(): Set { - val USE_SECTIONS_KEYWORDS = getRuleOrCheckpointSectionKeywords() + SnakemakeFrameworkAPIProvider.getInstance() + val USE_SECTIONS_KEYWORDS = getRuleOrCheckpointAllSectionTypesKeywords() + SnakemakeApiYamlAnnotationsService.getInstance() .collectAllPossibleUseSubsectionKeywords() - getExecutionSectionsKeyword() - SECTION_RUN return USE_SECTIONS_KEYWORDS @@ -368,9 +353,9 @@ class SnakemakeAPIProjectService(val project: Project): Disposable { private fun doRefresh(version: String?) { val newState = if (version == null) { - SnakemakeAPIProjectState.EMPTY + SnakemakeApiStateForLangLevel.EMPTY } else { - val apiProvider = SnakemakeFrameworkAPIProvider.getInstance() + val apiProvider = SnakemakeApiYamlAnnotationsService.getInstance() val contextType2SingleArgSectionKeywords = HashMap>() val contextType2PositionalOnlySectionKeywords = HashMap>() @@ -387,13 +372,13 @@ class SnakemakeAPIProjectService(val project: Project): Disposable { // add top-level data: val toplevelIntroductions = apiProvider.getToplevelIntroductions(smkLangVers) contextType2SingleArgSectionKeywords.put( - SmkAPIAnnParsingContextType.TOP_LEVEL.typeStr, + SmkApiAnnotationParsingContextType.TOP_LEVEL.typeStr, toplevelIntroductions.mapNotNull { (name, e) -> if (e.value.multipleArgsAllowed) null else name }.toMutableList() ) contextType2PositionalOnlySectionKeywords.put( - SmkAPIAnnParsingContextType.TOP_LEVEL.typeStr, + SmkApiAnnotationParsingContextType.TOP_LEVEL.typeStr, toplevelIntroductions.mapNotNull { (name, e) -> if (e.value.keywordArgsAllowed) null else name }.toMutableList() @@ -483,7 +468,7 @@ class SnakemakeAPIProjectService(val project: Project): Disposable { } } - SnakemakeAPIProjectState( + SnakemakeApiStateForLangLevel( contextType2SingleArgSectionKeywords = contextType2SingleArgSectionKeywords.toImmutableMap(), contextType2PositionalOnlySectionKeywords = contextType2PositionalOnlySectionKeywords.toImmutableMap(), contextTypeAndSubsection2LambdaArgs = contextTypeAndSubsection2LambdaArgs.toImmutableMap(), @@ -540,11 +525,11 @@ class SnakemakeAPIProjectService(val project: Project): Disposable { } companion object { - fun getInstance(project: Project) = project.getService(SnakemakeAPIProjectService::class.java)!! + fun getInstance(project: Project) = project.getService(SnakemakeApiService::class.java)!! } } -internal data class SnakemakeAPIProjectState( +internal data class SnakemakeApiStateForLangLevel( val contextType2SingleArgSectionKeywords: Map>, val contextType2PositionalOnlySectionKeywords: Map>, val contextTypeAndSubsection2LambdaArgs: Map>, @@ -553,15 +538,15 @@ internal data class SnakemakeAPIProjectState( val contextType2AccessibleInRuleObjectSubsectionKeywords: Map>, val contextType2AccessibleAccessibleAsPlaceholderSubsectionKeywords: Map>, val funFqnToSectionRestrictionList: Map>, - val functionDeprecationsByShortName: Map>, - val functionDeprecationsByFqn: Map>, + val functionDeprecationsByShortName: Map>, + val functionDeprecationsByFqn: Map>, val funFqnValidForInjection: Set, val funShortNamesValidForInjection: Set, ) { val subsectionsAllPossibleArgNames = contextTypeAndSubsection2LambdaArgs.values.flatMap { it.asIterable() }.toImmutableSet() companion object { - val EMPTY = SnakemakeAPIProjectState( + val EMPTY = SnakemakeApiStateForLangLevel( emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptySet(), emptySet() ) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkImplicitPySymbolsCompletionContributor.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkImplicitPySymbolsCompletionContributor.kt index 407b69a0..df8db30a 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkImplicitPySymbolsCompletionContributor.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkImplicitPySymbolsCompletionContributor.kt @@ -12,10 +12,10 @@ import com.jetbrains.python.psi.PyClass import com.jetbrains.python.psi.PyReferenceExpression import com.jetbrains.python.psi.resolve.CompletionVariantsProcessor import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.ImplicitPySymbolsProvider +import com.jetbrains.snakecharm.codeInsight.SmkImplicitPySymbolsProvider import com.jetbrains.snakecharm.codeInsight.SmkCodeInsightScope -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.SnakemakeNames.RUN_SECTION_VARIABLE_RULE import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpoint @@ -56,7 +56,7 @@ class SmkImplicitPySymbolsCompletionProvider : CompletionProvider also avoid duplicated items - val api = SnakemakeAPIProjectService.getInstance(project) + val api = SnakemakeApiService.getInstance(project) val contextKeyword = ruleOrCheckpoint.sectionKeyword for (sectionName in api.getSubsectionAccessibleAsPlaceholder(contextKeyword)) { if (cache.contains(SmkCodeInsightScope.RULELIKE_RUN_SECTION, sectionName)) { diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkKeywordCompletionContributor.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkKeywordCompletionContributor.kt index 0a435909..b05f42cc 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkKeywordCompletionContributor.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkKeywordCompletionContributor.kt @@ -18,13 +18,13 @@ import com.intellij.util.ProcessingContext import com.jetbrains.python.PyTokenTypes import com.jetbrains.python.codeInsight.completion.PythonLookupElement import com.jetbrains.python.psi.* -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SUBWORKFLOW_SECTIONS_KEYWORDS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.TOPLEVEL_ARGS_SECTION_KEYWORDS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.USE_DECLARATION_KEYWORDS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SUBWORKFLOW_SECTIONS_KEYWORDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.TOPLEVEL_ARGS_SECTION_KEYWORDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.USE_DECLARATION_KEYWORDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings -import com.jetbrains.snakecharm.framework.SnakemakeFrameworkAPIProvider -import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkAPIAnnParsingContextType +import com.jetbrains.snakecharm.framework.SnakemakeApiYamlAnnotationsService +import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkApiAnnotationParsingContextType import com.jetbrains.snakecharm.lang.SmkLanguageVersion import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.parser.SmkTokenTypes.RULE_LIKE @@ -132,7 +132,7 @@ object WorkflowTopLevelKeywordsProvider : CompletionProvider() result: CompletionResultSet ) { val element = parameters.position - val api = SnakemakeAPIProjectService.getInstance(element.project) - val keywords = api.getRuleOrCheckpointSectionKeywords() + val api = SnakemakeApiService.getInstance(element.project) + val keywords = api.getRuleOrCheckpointAllSectionTypesKeywords() filterByDeprecationAndAddLookupItems(element.project, keywords, result, priority = SmkCompletionUtil.SECTIONS_KEYS_PRIORITY){ val smkRuleOrCheckpoint = PsiTreeUtil.getParentOfType(element, SmkRuleOrCheckpoint::class.java) requireNotNull(smkRuleOrCheckpoint) { @@ -241,7 +241,7 @@ object ModuleSectionKeywordsProvider : CompletionProvider( result: CompletionResultSet ) { val element = parameters.position - val api = SnakemakeAPIProjectService.getInstance(element.project) + val api = SnakemakeApiService.getInstance(element.project) val keywords = api.getModuleSectionKeywords() filterByDeprecationAndAddLookupItems(element.project, keywords, result, priority = SmkCompletionUtil.SECTIONS_KEYS_PRIORITY) { val smkModule = PsiTreeUtil.getParentOfType(element, SmkModule::class.java) @@ -279,7 +279,7 @@ object UseSectionKeywordsProvider : CompletionProvider() { ) } - val api = SnakemakeAPIProjectService.getInstance(parameters.position.project) + val api = SnakemakeApiService.getInstance(parameters.position.project) val keywords = api.getUseSectionKeywords() filterByDeprecationAndAddLookupItems( parameters.position.project, @@ -302,7 +302,7 @@ private fun filterByDeprecationAndAddLookupItems( defaultTailType: TailType = ColonAndWhiteSpaceTail, parentContextProvider: () -> String? ) { - val deprecationProvider = SnakemakeFrameworkAPIProvider.getInstance() + val deprecationProvider = SnakemakeApiYamlAnnotationsService.getInstance() val settings = SmkSupportProjectSettings.getInstance(project) val contextName = parentContextProvider() diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkLambdaParameterInSectionCompletionContributor.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkLambdaParameterInSectionCompletionContributor.kt index 3b760d34..2b1ae3f1 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkLambdaParameterInSectionCompletionContributor.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/SmkLambdaParameterInSectionCompletionContributor.kt @@ -12,8 +12,8 @@ import com.jetbrains.python.PyTokenTypes import com.jetbrains.python.psi.PyCallExpression import com.jetbrains.python.psi.PyLambdaExpression import com.jetbrains.python.psi.PyParameterList -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection @@ -49,14 +49,14 @@ object SmkLambdaParameterInSectionCompletionProvider : CompletionProvider { result.addElement( TailTypeDecorator.withTail( - LookupElementBuilder.create(SnakemakeAPI.SMK_VARS_WILDCARDS) + LookupElementBuilder.create(SnakemakeApi.SMK_VARS_WILDCARDS) .withIcon(PlatformIcons.PARAMETER_ICON), ColonAndWhiteSpaceTail ) ) } else -> { - val apiService = SnakemakeAPIProjectService.getInstance(element.project) + val apiService = SnakemakeApiService.getInstance(element.project) val context = section.getParentRuleOrCheckPoint().sectionKeyword val args = apiService.getLambdaArgsForSubsection(sectionName, context) if (args.isNotEmpty()) { @@ -73,11 +73,11 @@ object SmkLambdaParameterInSectionCompletionProvider : CompletionProvider collectVariantsForElement( + SnakemakeApi.SMK_VARS_RULES -> collectVariantsForElement( parameters.position, isCheckPoint = false ) + collectVariantsForElement(parameters.position, isCheckPoint = true) - SnakemakeAPI.SMK_VARS_CHECKPOINTS -> collectVariantsForElement(parameters.position, isCheckPoint = true) + SnakemakeApi.SMK_VARS_CHECKPOINTS -> collectVariantsForElement(parameters.position, isCheckPoint = true) else -> return } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCrawler.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCrawler.kt index 637b7014..f126c551 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCrawler.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperCrawler.kt @@ -2,7 +2,7 @@ package com.jetbrains.snakecharm.codeInsight.completion.wrapper import com.intellij.openapi.util.io.FileUtil import com.intellij.util.io.write -import com.jetbrains.snakecharm.framework.SnakemakeFrameworkAPIProvider +import com.jetbrains.snakecharm.framework.SnakemakeApiYamlAnnotationsService import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.cbor.Cbor import kotlinx.serialization.encodeToByteArray @@ -53,7 +53,7 @@ object SmkWrapperCrawler { } println("Launching smk wrappers crawler...") - val provider = SnakemakeFrameworkAPIProvider(null) + val provider = SnakemakeApiYamlAnnotationsService(null) provider.reinitializeInTests(snakemakeAPIYamlPath.inputStream()) val wrappers = localWrapperParser(wrappersFolder, provider=provider) wrappers.forEach { wrapper -> @@ -113,7 +113,7 @@ object SmkWrapperCrawler { fun localWrapperParser( folder: String, - provider: SnakemakeFrameworkAPIProvider + provider: SnakemakeApiYamlAnnotationsService ): List { val wrappers = mutableListOf() val mainFolder = File(folder) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperStorage.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperStorage.kt index f684a255..f5459c74 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperStorage.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SmkWrapperStorage.kt @@ -10,7 +10,7 @@ import com.intellij.openapi.util.Disposer import com.jetbrains.snakecharm.SnakemakeBundle import com.jetbrains.snakecharm.SnakemakePluginUtil import com.jetbrains.snakecharm.SnakemakeTestUtil -import com.jetbrains.snakecharm.framework.SnakemakeFrameworkAPIProvider +import com.jetbrains.snakecharm.framework.SnakemakeApiYamlAnnotationsService import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings import com.jetbrains.snakecharm.framework.SmkSupportProjectSettingsListener import kotlinx.serialization.ExperimentalSerializationApi @@ -173,7 +173,7 @@ class SmkWrapperStorage(val project: Project) : Disposable { "file://${config.wrappersCustomSourcesFolder}", SmkWrapperCrawler.localWrapperParser( config.wrappersCustomSourcesFolder, - SnakemakeFrameworkAPIProvider.getInstance() + SnakemakeApiYamlAnnotationsService.getInstance() ) ) } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SnakemakeStartupActivity.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SnakemakeStartupActivity.kt index 71fcf1a4..f6d44f99 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SnakemakeStartupActivity.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/completion/wrapper/SnakemakeStartupActivity.kt @@ -3,26 +3,26 @@ package com.jetbrains.snakecharm.codeInsight.completion.wrapper import com.intellij.openapi.components.service import com.intellij.openapi.project.Project import com.intellij.openapi.startup.ProjectActivity -import com.jetbrains.snakecharm.codeInsight.ImplicitPySymbolsProvider -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SmkImplicitPySymbolsProvider +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings -import com.jetbrains.snakecharm.framework.SnakemakeFrameworkAPIProvider +import com.jetbrains.snakecharm.framework.SnakemakeApiYamlAnnotationsService import kotlinx.serialization.ExperimentalSerializationApi @ExperimentalSerializationApi class SnakemakeStartupActivity : ProjectActivity { override suspend fun execute(project: Project) { - SnakemakeFrameworkAPIProvider.getInstance() // other classes could use it implicitly + SnakemakeApiYamlAnnotationsService.getInstance() // other classes could use it implicitly val smkSettings = project.service() smkSettings.initOnStartup() - SnakemakeAPIProjectService.getInstance(project).initOnStartup(smkSettings) // other classes could use it implicitly + SnakemakeApiService.getInstance(project).initOnStartup(smkSettings) // other classes could use it implicitly val smkWrapperStorage = project.service() smkWrapperStorage.initOnStartup() - val implicitPySymbolsProvider = project.service() + val implicitPySymbolsProvider = project.service() implicitPySymbolsProvider.initOnStartup() } } \ No newline at end of file diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/resolve/SmkImplicitPySymbolsResolveProvider.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/resolve/SmkImplicitPySymbolsResolveProvider.kt index 8676efb0..ffaa0ced 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/resolve/SmkImplicitPySymbolsResolveProvider.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/resolve/SmkImplicitPySymbolsResolveProvider.kt @@ -6,9 +6,9 @@ import com.jetbrains.python.psi.resolve.PyReferenceResolveProvider import com.jetbrains.python.psi.resolve.RatedResolveResult import com.jetbrains.python.psi.types.TypeEvalContext import com.jetbrains.snakecharm.codeInsight.ImplicitPySymbolsCache -import com.jetbrains.snakecharm.codeInsight.ImplicitPySymbolsProvider +import com.jetbrains.snakecharm.codeInsight.SmkImplicitPySymbolsProvider import com.jetbrains.snakecharm.codeInsight.SmkCodeInsightScope -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_VARS_WILDCARDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_VARS_WILDCARDS import com.jetbrains.snakecharm.codeInsight.resolve.SmkImplicitPySymbolsResolveProviderCompanion.addSyntheticSymbols import com.jetbrains.snakecharm.codeInsight.resolve.SmkResolveUtil.RATE_IMPLICIT_SYMBOLS import com.jetbrains.snakecharm.lang.SnakemakeLanguageDialect @@ -58,7 +58,7 @@ class SmkImplicitPySymbolsResolveProvider : PyReferenceResolveProvider { } } - val cache = ImplicitPySymbolsProvider.instance(element.project).cache + val cache = SmkImplicitPySymbolsProvider.instance(element.project).cache addSyntheticSymbols(contextScope, cache, referencedName, items) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/framework/SmkFrameworkProjectSettings.kt b/src/main/kotlin/com/jetbrains/snakecharm/framework/SmkFrameworkProjectSettings.kt index 67c7eb80..a4c44e3c 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/framework/SmkFrameworkProjectSettings.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/framework/SmkFrameworkProjectSettings.kt @@ -132,7 +132,7 @@ class SmkSupportProjectSettings(val project: Project) : PersistentStateComponent var snakemakeSupportBannerEnabled by property(true) @get:Attribute("smk_language_version") - var snakemakeLanguageVersion by string(SnakemakeFrameworkAPIProvider.getInstance().getDefaultVersion()) + var snakemakeLanguageVersion by string(SnakemakeApiYamlAnnotationsService.getInstance().getDefaultVersion()) } companion object { diff --git a/src/main/kotlin/com/jetbrains/snakecharm/framework/SnakemakeFrameworkAPIProvider.kt b/src/main/kotlin/com/jetbrains/snakecharm/framework/SnakemakeApiYamlAnnotationsService.kt similarity index 75% rename from src/main/kotlin/com/jetbrains/snakecharm/framework/SnakemakeFrameworkAPIProvider.kt rename to src/main/kotlin/com/jetbrains/snakecharm/framework/SnakemakeApiYamlAnnotationsService.kt index 7115619e..a6084220 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/framework/SnakemakeFrameworkAPIProvider.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/framework/SnakemakeApiYamlAnnotationsService.kt @@ -27,18 +27,18 @@ import kotlin.io.path.inputStream * YAML snakemake api description state & parser */ @Service -class SnakemakeFrameworkAPIProvider( +class SnakemakeApiYamlAnnotationsService( application: Application? // required to launch outside of IDEA process ) { - private lateinit var topLevelName2Deprecations: Map> - private lateinit var functionFqn2Deprecations: Map> - private lateinit var functionShortName2Deprecations: Map> - private lateinit var subsectionName2Deprecations: Map> + private lateinit var topLevelName2Deprecations: Map> + private lateinit var functionFqn2Deprecations: Map> + private lateinit var functionShortName2Deprecations: Map> + private lateinit var subsectionName2Deprecations: Map> - private lateinit var functionFqn2Introduction: Map> - private lateinit var functionShortName2Introduction: Map> - private lateinit var topLevelName2Introduction: Map> - private lateinit var subsectionName2Introduction: Map> + private lateinit var functionFqn2Introduction: Map> + private lateinit var functionShortName2Introduction: Map> + private lateinit var topLevelName2Introduction: Map> + private lateinit var subsectionName2Introduction: Map> private lateinit var defaultVersion: String @@ -48,7 +48,7 @@ class SnakemakeFrameworkAPIProvider( reinitializeInTests() } else { val pluginSandboxPath = SnakemakePluginUtil.getPluginSandboxPath( - SnakemakeFrameworkAPIProvider::class.java + SnakemakeApiYamlAnnotationsService::class.java ) initialize(pluginSandboxPath.resolve("extra/snakemake_api.yaml")) } @@ -81,23 +81,23 @@ class SnakemakeFrameworkAPIProvider( } private fun initialize(inputStream: InputStream?) { - val yaml = Yaml(CustomClassLoaderConstructor(SmkAPIAnnParsingConfig::class.java.classLoader, LoaderOptions())) + val yaml = Yaml(CustomClassLoaderConstructor(SmkApiAnnotationParsingConfig::class.java.classLoader, LoaderOptions())) yaml.setBeanAccess(BeanAccess.FIELD) // it must be set to be able to set vals - val yamlData = yaml.loadAs(inputStream, SmkAPIAnnParsingConfig::class.java) + val yamlData = yaml.loadAs(inputStream, SmkApiAnnotationParsingConfig::class.java) // Deprecation Data - val functionDeprecationByFqnInfo = emptyMap>().toMutableMap() - val functionDeprecationByShortnameInfo = emptyMap>().toMutableMap() - val topLevelDeprecationInfo = emptyMap>().toMutableMap() + val functionDeprecationByFqnInfo = emptyMap>().toMutableMap() + val functionDeprecationByShortnameInfo = emptyMap>().toMutableMap() + val topLevelDeprecationInfo = emptyMap>().toMutableMap() val subsectionDeprecationInfo = - emptyMap>().toMutableMap() + emptyMap>().toMutableMap() // Introduction Data - val topLevelIntroductionInfo = emptyMap>().toMutableMap() - val funIntroductionByFqnInfo = emptyMap>().toMutableMap() - val funFqnIntroductionByShortnameInfo = emptyMap>().toMutableMap() + val topLevelIntroductionInfo = emptyMap>().toMutableMap() + val funIntroductionByFqnInfo = emptyMap>().toMutableMap() + val funFqnIntroductionByShortnameInfo = emptyMap>().toMutableMap() val subsectionIntroductionInfo = - emptyMap>().toMutableMap() + emptyMap>().toMutableMap() defaultVersion = yamlData.defaultVersion for (versionData in yamlData.changelog) { @@ -120,25 +120,25 @@ class SnakemakeFrameworkAPIProvider( private fun filIntroductionData( languageVersion: SmkLanguageVersion, - versionChangeNotes: SmkAPIAnnParsingVersionRecord, - functionDeprecationByFqnInfo: MutableMap>, - functionDeprecationByShortnameInfo: MutableMap>, - topLevelIntroductionData: MutableMap>, - subsectionIntroductionData: MutableMap>, + versionChangeNotes: SmkApiAnnotationParsingVersionRecord, + functionDeprecationByFqnInfo: MutableMap>, + functionDeprecationByShortnameInfo: MutableMap>, + topLevelIntroductionData: MutableMap>, + subsectionIntroductionData: MutableMap>, ) { // Process: // here 'introduced' and 'override' are synonyms, just for better understanding use 2 different types in // annotations, like first was introduced, than changed - for (record: SmkAPIAnnParsingIntroductionRecord in versionChangeNotes.introduced) { + for (record: SmkApiAnnotationParsingIntroductionRecord in versionChangeNotes.introduced) { updateBasedOnRecContextType( - record, SmkKeywordIntroductionParams.createFrom(record), + record, SmkApiAnnotationKeywordIntroductionParams.createFrom(record), languageVersion, functionDeprecationByFqnInfo, functionDeprecationByShortnameInfo, topLevelIntroductionData, subsectionIntroductionData ) } - for (record: SmkAPIAnnParsingIntroductionRecord in versionChangeNotes.override) { + for (record: SmkApiAnnotationParsingIntroductionRecord in versionChangeNotes.override) { updateBasedOnRecContextType( - record, SmkKeywordIntroductionParams.createFrom(record), + record, SmkApiAnnotationKeywordIntroductionParams.createFrom(record), languageVersion, functionDeprecationByFqnInfo, functionDeprecationByShortnameInfo, topLevelIntroductionData, subsectionIntroductionData ) } @@ -146,32 +146,32 @@ class SnakemakeFrameworkAPIProvider( private fun fillDeprecationInfo( languageVersion: SmkLanguageVersion, - versionChangeNotes: SmkAPIAnnParsingVersionRecord, - functionDeprecationByFqnInfo: MutableMap>, - functionDeprecationByShortnameInfo: MutableMap>, - topLevelDeprecationInfo: MutableMap>, - subsectionDeprecationInfo: MutableMap> + versionChangeNotes: SmkApiAnnotationParsingVersionRecord, + functionDeprecationByFqnInfo: MutableMap>, + functionDeprecationByShortnameInfo: MutableMap>, + topLevelDeprecationInfo: MutableMap>, + subsectionDeprecationInfo: MutableMap> ) { // info from 'deprecated section' - for (record: SmkAPIAnnParsingDeprecationRecord in versionChangeNotes.deprecated) { + for (record: SmkApiAnnotationParsingDeprecationRecord in versionChangeNotes.deprecated) { updateBasedOnRecContextType( - record, SmkKeywordDeprecationParams.createFrom(false, record), + record, SmkApiAnnotationKeywordDeprecationParams.createFrom(false, record), languageVersion, functionDeprecationByFqnInfo, functionDeprecationByShortnameInfo, topLevelDeprecationInfo, subsectionDeprecationInfo ) } // info from 'removed section' - for (record: SmkAPIAnnParsingDeprecationRecord in versionChangeNotes.removed) { + for (record: SmkApiAnnotationParsingDeprecationRecord in versionChangeNotes.removed) { updateBasedOnRecContextType( - record, SmkKeywordDeprecationParams.createFrom(true, record), + record, SmkApiAnnotationKeywordDeprecationParams.createFrom(true, record), languageVersion, functionDeprecationByFqnInfo, functionDeprecationByShortnameInfo, topLevelDeprecationInfo, subsectionDeprecationInfo ) } } - private fun updateBasedOnRecContextType( + private fun updateBasedOnRecContextType( rec: A, params: B, languageVersion: SmkLanguageVersion, @@ -182,7 +182,7 @@ class SnakemakeFrameworkAPIProvider( ) { val typeOrContext = rec.type when (typeOrContext) { - SmkAPIAnnParsingContextType.FUNCTION.typeStr -> { + SmkApiAnnotationParsingContextType.FUNCTION.typeStr -> { if (functionsFqnInfo != null) { functionsFqnInfo.getOrPut(rec.name) { TreeMap() }[languageVersion] = params } @@ -193,12 +193,12 @@ class SnakemakeFrameworkAPIProvider( } } - SmkAPIAnnParsingContextType.TOP_LEVEL.typeStr -> { + SmkApiAnnotationParsingContextType.TOP_LEVEL.typeStr -> { topLevelInfo.getOrPut(rec.name) { TreeMap() }[languageVersion] = params } // else: subsection type: else -> { - if (typeOrContext == SmkAPIAnnParsingContextType.RULE_LIKE.typeStr) { + if (typeOrContext == SmkApiAnnotationParsingContextType.RULE_LIKE.typeStr) { RULE_LIKE_KEYWORDS.forEach { ctxDirective -> subsectionsInfo.getOrPut(SmkAPISubsectionContextAndDirective(ctxDirective, rec.name)) { TreeMap() }[languageVersion] = params @@ -219,7 +219,7 @@ class SnakemakeFrameworkAPIProvider( * @return Pair of latest deprecation/removal update that was made to the top level keyword as of provided version, * and advice if any was assigned to the change */ - fun getTopLevelDeprecation(name: String, version: SmkLanguageVersion): Pair? = + fun getTopLevelDeprecation(name: String, version: SmkLanguageVersion): Pair? = getKeywordDeprecation(topLevelName2Deprecations[name], version) /** @@ -229,7 +229,7 @@ class SnakemakeFrameworkAPIProvider( * @return Pair of latest deprecation/removal update that was made to the subsection keyword as of provided version, * and advice if any was assigned to the change */ - fun getSubsectionDeprecation(name: String, version: SmkLanguageVersion, contextSectionKeyword: String): Pair? = + fun getSubsectionDeprecation(name: String, version: SmkLanguageVersion, contextSectionKeyword: String): Pair? = getKeywordDeprecation(subsectionName2Deprecations[SmkAPISubsectionContextAndDirective(contextSectionKeyword, name)], version) /** @@ -241,7 +241,7 @@ class SnakemakeFrameworkAPIProvider( fun getFunctionDeprecationByFqn( fqn: String, version: SmkLanguageVersion - ): Pair? = getKeywordDeprecation( + ): Pair? = getKeywordDeprecation( functionFqn2Deprecations[fqn], version ) @@ -249,7 +249,7 @@ class SnakemakeFrameworkAPIProvider( fun getFunctionDeprecationByShortName( name: String, version: SmkLanguageVersion - ): Pair? = getKeywordDeprecation( + ): Pair? = getKeywordDeprecation( functionShortName2Deprecations[name], version ) @@ -311,49 +311,49 @@ class SnakemakeFrameworkAPIProvider( fun getSubsectionIntroduction( name: String, version: SmkLanguageVersion, contextSectionKeyword: String - ): Map.Entry? { + ): Map.Entry? { val vers2ParamsTree = subsectionName2Introduction[SmkAPISubsectionContextAndDirective(contextSectionKeyword, name)] return vers2ParamsTree?.floorEntry(version) } fun getToplevelIntroduction( name: String, version: SmkLanguageVersion - ): Map.Entry? { + ): Map.Entry? { val vers2ParamsTree = topLevelName2Introduction[name] return vers2ParamsTree?.floorEntry(version) } fun getFunctionIntroductionsByFqn( version: SmkLanguageVersion - ): List>> = functionFqn2Introduction.mapNotNull { (directive, vers2ParamsTree) -> + ): List>> = functionFqn2Introduction.mapNotNull { (directive, vers2ParamsTree) -> val entry = vers2ParamsTree.floorEntry(version) if (entry == null) null else (directive to entry) } fun getFunctionDeprecationsByFqn( version: SmkLanguageVersion - ): List>> = functionFqn2Deprecations.mapNotNull { (directive, vers2ParamsTree) -> + ): List>> = functionFqn2Deprecations.mapNotNull { (directive, vers2ParamsTree) -> val entry = vers2ParamsTree.floorEntry(version) if (entry == null) null else (directive to entry) } fun getFunctionDeprecationsByShortName( version: SmkLanguageVersion - ): List>> = functionShortName2Deprecations.mapNotNull { (directive, vers2ParamsTree) -> + ): List>> = functionShortName2Deprecations.mapNotNull { (directive, vers2ParamsTree) -> val entry = vers2ParamsTree.floorEntry(version) if (entry == null) null else (directive to entry) } fun getToplevelIntroductions( version: SmkLanguageVersion - ): List>> = topLevelName2Introduction.mapNotNull { (directive, vers2ParamsTree) -> + ): List>> = topLevelName2Introduction.mapNotNull { (directive, vers2ParamsTree) -> val entry = vers2ParamsTree.floorEntry(version) if (entry == null) null else (directive to entry) } fun getSubsectionsIntroductions( version: SmkLanguageVersion - ): List>> { + ): List>> { return subsectionName2Introduction.mapNotNull { (ctxAndDirective, vers2ParamsTree) -> val entry = vers2ParamsTree.floorEntry(version) if (entry == null) null else (ctxAndDirective to (entry.key to entry.value)) @@ -361,9 +361,9 @@ class SnakemakeFrameworkAPIProvider( } private fun getKeywordDeprecation( - keywords: TreeMap?, + keywords: TreeMap?, version: SmkLanguageVersion - ): Pair? { + ): Pair? { val floorEntry = keywords?.floorEntry(version) if (floorEntry == null) { return null @@ -380,7 +380,7 @@ class SnakemakeFrameworkAPIProvider( ) fun getInstance() = - ApplicationManager.getApplication().getService(SnakemakeFrameworkAPIProvider::class.java)!! + ApplicationManager.getApplication().getService(SnakemakeApiYamlAnnotationsService::class.java)!! } } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkAPIAnnParams.kt b/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkApiAnnotationParams.kt similarity index 77% rename from src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkAPIAnnParams.kt rename to src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkApiAnnotationParams.kt index 2a2032a5..f2f9634a 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkAPIAnnParams.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkApiAnnotationParams.kt @@ -1,12 +1,12 @@ package com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations -data class SmkKeywordDeprecationParams( +data class SmkApiAnnotationKeywordDeprecationParams( val name: String, val itemRemoved: Boolean, val advice: String?, ) { companion object { - fun createFrom(itemRemoved: Boolean, record: SmkAPIAnnParsingDeprecationRecord) = SmkKeywordDeprecationParams( + fun createFrom(itemRemoved: Boolean, record: SmkApiAnnotationParsingDeprecationRecord) = SmkApiAnnotationKeywordDeprecationParams( name = record.name, itemRemoved = itemRemoved, advice = record.advice.ifEmpty { null }, @@ -14,7 +14,7 @@ data class SmkKeywordDeprecationParams( } } -data class SmkKeywordIntroductionParams( +data class SmkApiAnnotationKeywordIntroductionParams( //val name: String, val lambdaArgs: List, val keywordArgsAllowed: Boolean, @@ -27,7 +27,7 @@ data class SmkKeywordIntroductionParams( val limitToSections: List, ) { companion object { - fun createFrom(rec: SmkAPIAnnParsingIntroductionRecord) = SmkKeywordIntroductionParams( + fun createFrom(rec: SmkApiAnnotationParsingIntroductionRecord) = SmkApiAnnotationKeywordIntroductionParams( //name = rec.name, lambdaArgs = rec.lambda_args, limitToSections = rec.limit_to_sections, @@ -39,7 +39,7 @@ data class SmkKeywordIntroductionParams( false -> false else -> { // default: FALSE for functions, TRUE for sections - rec.type != SmkAPIAnnParsingContextType.FUNCTION.typeStr + rec.type != SmkApiAnnotationParsingContextType.FUNCTION.typeStr } }, isPlaceholderExpandedToWildcard = rec.placeholders_resolved_as_wildcards, diff --git a/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkAPIAnnParsingTypes.kt b/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkApiAnnotationParsingTypes.kt similarity index 57% rename from src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkAPIAnnParsingTypes.kt rename to src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkApiAnnotationParsingTypes.kt index 85b0a55e..874af4dd 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkAPIAnnParsingTypes.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkApiAnnotationParsingTypes.kt @@ -1,25 +1,25 @@ package com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations -data class SmkAPIAnnParsingVersionRecord( +data class SmkApiAnnotationParsingVersionRecord( val version: String = "", - val introduced: List = emptyList(), - val override: List = emptyList(), - val deprecated: List = emptyList(), - val removed: List = emptyList(), + val introduced: List = emptyList(), + val override: List = emptyList(), + val deprecated: List = emptyList(), + val removed: List = emptyList(), ) -interface SmkAPIAnnParsingAbstractRecord { +interface SmkApiAnnotationParsingAbstractRecord { val name: String val type: String } -data class SmkAPIAnnParsingDeprecationRecord( +data class SmkApiAnnotationParsingDeprecationRecord( override val name: String = "", override val type: String = "", val advice: String = "", -): SmkAPIAnnParsingAbstractRecord +): SmkApiAnnotationParsingAbstractRecord -data class SmkAPIAnnParsingIntroductionRecord( +data class SmkApiAnnotationParsingIntroductionRecord( override val name: String = "", override val type: String = "", val advice: String = "", @@ -36,15 +36,15 @@ data class SmkAPIAnnParsingIntroductionRecord( val is_accessible_as_placeholder: Boolean = false, // for functions: val limit_to_sections: List = emptyList(), -): SmkAPIAnnParsingAbstractRecord +): SmkApiAnnotationParsingAbstractRecord -data class SmkAPIAnnParsingConfig( - val changelog: List = emptyList(), +data class SmkApiAnnotationParsingConfig( + val changelog: List = emptyList(), val defaultVersion: String = "0.0.0", val annotationsFormatVersion: Int = 0 ) -enum class SmkAPIAnnParsingContextType(val typeStr: String) { +enum class SmkApiAnnotationParsingContextType(val typeStr: String) { TOP_LEVEL("top-level"), RULE_LIKE("rule-like"), FUNCTION("function"), diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkDepreciatedKeywordsInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkDepreciatedKeywordsInspection.kt index 724a2140..ce6c2c88 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkDepreciatedKeywordsInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkDepreciatedKeywordsInspection.kt @@ -8,10 +8,10 @@ import com.jetbrains.python.psi.PyClass import com.jetbrains.python.psi.PyFunction import com.jetbrains.python.psi.PyReferenceExpression import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings -import com.jetbrains.snakecharm.framework.SnakemakeFrameworkAPIProvider -import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkKeywordDeprecationParams +import com.jetbrains.snakecharm.framework.SnakemakeApiYamlAnnotationsService +import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkApiAnnotationKeywordDeprecationParams import com.jetbrains.snakecharm.lang.SmkLanguageVersion import com.jetbrains.snakecharm.lang.SnakemakeNames.CHECKPOINT_KEYWORD import com.jetbrains.snakecharm.lang.SnakemakeNames.MODULE_KEYWORD @@ -28,8 +28,8 @@ class SmkDepreciatedKeywordsInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val apiService = SnakemakeAPIProjectService.getInstance(holder.project) - val deprecationProvider = SnakemakeFrameworkAPIProvider.getInstance() + val apiService = SnakemakeApiService.getInstance(holder.project) + val deprecationProvider = SnakemakeApiYamlAnnotationsService.getInstance() val snakemakeSettings = SmkSupportProjectSettings.getInstance(holder.project) override fun visitSmkRule(rule: SmkRule) { @@ -133,7 +133,7 @@ class SmkDepreciatedKeywordsInspection : SnakemakeInspection() { } fun showPropblem( - deprecationEntry: Pair, + deprecationEntry: Pair, name: String, node: PsiElement, basedOnFqn: Boolean @@ -255,7 +255,7 @@ class SmkDepreciatedKeywordsInspection : SnakemakeInspection() { private fun checkSubSectionDefinition(psiElement: PsiElement, name: String, parentName: String) { val settings = SmkSupportProjectSettings.getInstance(holder.project) - val deprecationProvider = SnakemakeFrameworkAPIProvider.getInstance() + val deprecationProvider = SnakemakeApiYamlAnnotationsService.getInstance() val lowestVersion = deprecationProvider.getSubSectionIntroductionVersion(name, parentName) val currentVersionString = settings.snakemakeLanguageVersion val currentVersion = if (currentVersionString == null) null else SmkLanguageVersion(currentVersionString) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkExecutionSubsectionInUseSectionInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkExecutionSubsectionInUseSectionInspection.kt index 024da95e..f2775402 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkExecutionSubsectionInUseSectionInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkExecutionSubsectionInUseSectionInspection.kt @@ -3,7 +3,7 @@ package com.jetbrains.snakecharm.inspections import com.intellij.codeInspection.LocalInspectionToolSession import com.intellij.codeInspection.ProblemsHolder import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection import com.jetbrains.snakecharm.lang.psi.SmkUse @@ -14,7 +14,7 @@ class SmkExecutionSubsectionInUseSectionInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val api = SnakemakeAPIProjectService.getInstance(holder.project) + val api = SnakemakeApiService.getInstance(holder.project) override fun visitSmkRuleOrCheckpointArgsSection(st: SmkRuleOrCheckpointArgsSection) { val sectionNamePsi = st.nameIdentifier diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkIgnorePyInspectionExtension.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkIgnorePyInspectionExtension.kt index 5a03a2e4..822a8939 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkIgnorePyInspectionExtension.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkIgnorePyInspectionExtension.kt @@ -9,7 +9,7 @@ import com.jetbrains.python.psi.PyElement import com.jetbrains.python.psi.PyQualifiedExpression import com.jetbrains.python.psi.types.PyType import com.jetbrains.python.psi.types.TypeEvalContext -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi import com.jetbrains.snakecharm.lang.psi.SmkModule import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection import com.jetbrains.snakecharm.lang.psi.SmkUse @@ -56,8 +56,8 @@ class SmkIgnorePyInspectionExtension : PyInspectionExtension() { // Maybe referenceName is better here? //val referencedName = node.referencedName //return "config".equals(referencedName) - return node.textMatches(SnakemakeAPI.SMK_VARS_CONFIG) || - node.textMatches(SnakemakeAPI.SMK_VARS_PEP) + return node.textMatches(SnakemakeApi.SMK_VARS_CONFIG) || + node.textMatches(SnakemakeApi.SMK_VARS_PEP) } return false } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkLambdaRuleParamsInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkLambdaRuleParamsInspection.kt index 84ea6c42..0a9788df 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkLambdaRuleParamsInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkLambdaRuleParamsInspection.kt @@ -7,8 +7,8 @@ import com.jetbrains.python.inspections.quickfix.RenameParameterQuickFix import com.jetbrains.python.psi.PyKeywordArgument import com.jetbrains.python.psi.PyLambdaExpression import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection class SmkLambdaRuleParamsInspection : SnakemakeInspection() { @@ -17,7 +17,7 @@ class SmkLambdaRuleParamsInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession, ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val apiService = SnakemakeAPIProjectService.getInstance(holder.project) + val apiService = SnakemakeApiService.getInstance(holder.project) override fun visitSmkRuleOrCheckpointArgsSection(st: SmkRuleOrCheckpointArgsSection) { val lambdas = st.argumentList?.arguments?.filterIsInstance() ?: emptyList() @@ -63,7 +63,7 @@ class SmkLambdaRuleParamsInspection : SnakemakeInspection() { ) { lambdas.forEach { lambda -> lambda.parameterList.parameters.forEachIndexed { index, pyParameter -> - if (index == 0 && pyParameter.name != SnakemakeAPI.SMK_VARS_WILDCARDS) { + if (index == 0 && pyParameter.name != SnakemakeApi.SMK_VARS_WILDCARDS) { if (pyParameter.name in optionalParameters) { registerProblem( pyParameter, @@ -79,11 +79,11 @@ class SmkLambdaRuleParamsInspection : SnakemakeInspection() { SnakemakeBundle.message("INSP.NAME.wildcards.first.parameter.preferable"), ProblemHighlightType.WEAK_WARNING, null, - RenameParameterQuickFix(SnakemakeAPI.SMK_VARS_WILDCARDS) + RenameParameterQuickFix(SnakemakeApi.SMK_VARS_WILDCARDS) ) } } - if (index != 0 && pyParameter.name == SnakemakeAPI.SMK_VARS_WILDCARDS) { + if (index != 0 && pyParameter.name == SnakemakeApi.SMK_VARS_WILDCARDS) { registerProblem( pyParameter, SnakemakeBundle.message("INSP.NAME.wildcards.first.parameter") diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkMisuseUsageIOFlagMethodsInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkMisuseUsageIOFlagMethodsInspection.kt index ee7c7759..23363367 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkMisuseUsageIOFlagMethodsInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkMisuseUsageIOFlagMethodsInspection.kt @@ -7,7 +7,7 @@ import com.jetbrains.python.psi.PyClass import com.jetbrains.python.psi.PyFunction import com.jetbrains.python.psi.PyReferenceExpression import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.psi.SmkFile import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection @@ -26,7 +26,7 @@ class SmkMisuseUsageIOFlagMethodsInspection : SnakemakeInspection() { val argList = st.argumentList ?: return - val apiService = SnakemakeAPIProjectService.getInstance(holder.project) + val apiService = SnakemakeApiService.getInstance(holder.project) argList.arguments .filterIsInstance() diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkRuleSectionAfterExecutionInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkRuleSectionAfterExecutionInspection.kt index d72df614..780de77c 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkRuleSectionAfterExecutionInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkRuleSectionAfterExecutionInspection.kt @@ -13,7 +13,7 @@ import com.intellij.psi.SmartPsiElementPointer import com.intellij.psi.util.PsiTreeUtil import com.jetbrains.python.psi.PyStatementList import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.psi.* class SmkRuleSectionAfterExecutionInspection : SnakemakeInspection() { @@ -22,7 +22,7 @@ class SmkRuleSectionAfterExecutionInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession, ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val api = SnakemakeAPIProjectService.getInstance(holder.project) + val api = SnakemakeApiService.getInstance(holder.project) override fun visitSmkRule(rule: SmkRule) { visitSMKRuleLike(rule) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionMultilineStringArgsInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionMultilineStringArgsInspection.kt index 7daefe23..60a63436 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionMultilineStringArgsInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionMultilineStringArgsInspection.kt @@ -10,7 +10,7 @@ import com.jetbrains.python.psi.PyElementVisitor import com.jetbrains.python.psi.PyParenthesizedExpression import com.jetbrains.python.psi.PyStringLiteralExpression import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.psi.SmkArgsSection import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection import com.jetbrains.snakecharm.lang.psi.SmkSubworkflowArgsSection @@ -21,7 +21,7 @@ class SmkSectionMultilineStringArgsInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession, ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val apiService = SnakemakeAPIProjectService.getInstance(holder.project) + val apiService = SnakemakeApiService.getInstance(holder.project) private val stringVisitor = object : MultilineStringVisitor() { override fun reportSmkProblem(psiElement: PsiElement, text: String) { diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionMultipleArgsInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionMultipleArgsInspection.kt index 7ae8af18..1346d7bb 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionMultipleArgsInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionMultipleArgsInspection.kt @@ -4,9 +4,9 @@ import com.intellij.codeInspection.LocalInspectionToolSession import com.intellij.codeInspection.ProblemsHolder import com.jetbrains.python.psi.PyArgumentList import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings -import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkAPIAnnParsingContextType +import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkApiAnnotationParsingContextType import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.psi.* @@ -16,7 +16,7 @@ class SmkSectionMultipleArgsInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession, ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val apiService = SnakemakeAPIProjectService.getInstance(holder.project) + val apiService = SnakemakeApiService.getInstance(holder.project) override fun visitSmkSubworkflowArgsSection(st: SmkSubworkflowArgsSection) { processSubSection(st, SnakemakeNames.SUBWORKFLOW_KEYWORD) @@ -40,7 +40,7 @@ class SmkSectionMultipleArgsInspection : SnakemakeInspection() { override fun visitSmkWorkflowArgsSection(st: SmkWorkflowArgsSection) { val keyword = st.sectionKeyword - val contextType = SmkAPIAnnParsingContextType.TOP_LEVEL.typeStr + val contextType = SmkApiAnnotationParsingContextType.TOP_LEVEL.typeStr if (keyword != null && apiService.isSubsectionSingleArgumentOnly(keyword, contextType)) { checkArgumentList(st.argumentList, keyword) } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionUnexpectedCallableArgsInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionUnexpectedCallableArgsInspection.kt index 05522750..f965b8b0 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionUnexpectedCallableArgsInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionUnexpectedCallableArgsInspection.kt @@ -7,7 +7,7 @@ import com.jetbrains.python.psi.PyLambdaExpression import com.jetbrains.python.psi.PyReferenceExpression import com.jetbrains.python.psi.types.PyFunctionType import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings import com.jetbrains.snakecharm.lang.psi.SmkArgsSection import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection @@ -18,7 +18,7 @@ class SmkSectionUnexpectedCallableArgsInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession, ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val apiService = SnakemakeAPIProjectService.getInstance(holder.project) + val apiService = SnakemakeApiService.getInstance(holder.project) override fun visitSmkRuleOrCheckpointArgsSection(st: SmkRuleOrCheckpointArgsSection) { diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionUnexpectedKeywordArgsInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionUnexpectedKeywordArgsInspection.kt index 790fd785..7e96c290 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionUnexpectedKeywordArgsInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionUnexpectedKeywordArgsInspection.kt @@ -5,9 +5,9 @@ import com.intellij.codeInspection.ProblemsHolder import com.jetbrains.python.psi.PyArgumentList import com.jetbrains.python.psi.PyKeywordArgument import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings -import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkAPIAnnParsingContextType +import com.jetbrains.snakecharm.framework.snakemakeAPIAnnotations.SmkApiAnnotationParsingContextType import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.psi.* @@ -17,7 +17,7 @@ class SmkSectionUnexpectedKeywordArgsInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val apiService = SnakemakeAPIProjectService.getInstance(holder.project) + val apiService = SnakemakeApiService.getInstance(holder.project) override fun visitSmkSubworkflowArgsSection(st: SmkSubworkflowArgsSection) { processSubSection(st, SnakemakeNames.SUBWORKFLOW_KEYWORD) @@ -29,7 +29,7 @@ class SmkSectionUnexpectedKeywordArgsInspection : SnakemakeInspection() { } override fun visitSmkWorkflowArgsSection(st: SmkWorkflowArgsSection) { - processSubSection(st, SmkAPIAnnParsingContextType.TOP_LEVEL.typeStr) + processSubSection(st, SmkApiAnnotationParsingContextType.TOP_LEVEL.typeStr) } private fun processSubSection(st: SmkArgsSection, contextKeyword: String?) { diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionVariableRequiresLambdaAccessInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionVariableRequiresLambdaAccessInspection.kt index 463b253a..06edcd30 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionVariableRequiresLambdaAccessInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSectionVariableRequiresLambdaAccessInspection.kt @@ -8,8 +8,8 @@ import com.intellij.psi.util.parentOfTypes import com.jetbrains.python.psi.PyLambdaExpression import com.jetbrains.python.psi.PyReferenceExpression import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_VARS_WILDCARDS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_VARS_WILDCARDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.psi.SmkArgsSection class SmkSectionVariableRequiresLambdaAccessInspection : SnakemakeInspection() { @@ -18,7 +18,7 @@ class SmkSectionVariableRequiresLambdaAccessInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession, ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val api = SnakemakeAPIProjectService.getInstance(holder.project) + val api = SnakemakeApiService.getInstance(holder.project) override fun visitPyReferenceExpression(node: PyReferenceExpression) { @Suppress("UnstableApiUsage") diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUndeclaredSectionInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUndeclaredSectionInspection.kt index e039788b..65f48169 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUndeclaredSectionInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUndeclaredSectionInspection.kt @@ -4,7 +4,7 @@ import com.intellij.codeInspection.LocalInspectionToolSession import com.intellij.codeInspection.ProblemsHolder import com.jetbrains.python.psi.PyReferenceExpression import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.inspections.smksl.SmkSLUndeclaredSectionInspectionUtil import com.jetbrains.snakecharm.lang.psi.impl.refs.SmkPyReferenceImpl @@ -14,7 +14,7 @@ class SmkUndeclaredSectionInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession, ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val api = SnakemakeAPIProjectService.getInstance(holder.project) + val api = SnakemakeApiService.getInstance(holder.project) override fun visitPyReferenceExpression(expr: PyReferenceExpression) { val ref = expr.reference diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUnrecognizedSectionInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUnrecognizedSectionInspection.kt index efc4992d..616e5586 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUnrecognizedSectionInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUnrecognizedSectionInspection.kt @@ -5,8 +5,8 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.codeInspection.ui.ListEditForm import com.intellij.psi.util.elementType import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SUBWORKFLOW_SECTIONS_KEYWORDS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SUBWORKFLOW_SECTIONS_KEYWORDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.inspections.quickfix.AddIgnoredElementQuickFix import com.jetbrains.snakecharm.lang.SnakemakeNames.SECTION_RUN import com.jetbrains.snakecharm.lang.psi.* @@ -22,7 +22,7 @@ class SmkUnrecognizedSectionInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession, ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val api = SnakemakeAPIProjectService.getInstance(holder.project) + val api = SnakemakeApiService.getInstance(holder.project) override fun visitSmkSubworkflowArgsSection(st: SmkSubworkflowArgsSection) { isSectionRecognized(st, SUBWORKFLOW_SECTIONS_KEYWORDS) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUnusedLogFileInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUnusedLogFileInspection.kt index 76887403..5f4f5e7a 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUnusedLogFileInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUnusedLogFileInspection.kt @@ -14,7 +14,7 @@ import com.jetbrains.python.psi.PyBinaryExpression import com.jetbrains.python.psi.PyStringElement import com.jetbrains.python.psi.PyStringLiteralExpression import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.psi.* @@ -29,7 +29,7 @@ class SmkUnusedLogFileInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession ) = object : SnakemakeInspectionVisitor(holder, getContext(session)) { - val api = SnakemakeAPIProjectService.getInstance(holder.project) + val api = SnakemakeApiService.getInstance(holder.project) override fun visitSmkUse(use: SmkUse) { val logSection = use.getSectionByName(SnakemakeNames.SECTION_LOG) ?: return diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/smksl/SmkSLUndeclaredSectionInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/smksl/SmkSLUndeclaredSectionInspection.kt index 33dd15f5..a4a6f60e 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/smksl/SmkSLUndeclaredSectionInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/smksl/SmkSLUndeclaredSectionInspection.kt @@ -6,8 +6,8 @@ import com.intellij.psi.PsiReference import com.jetbrains.python.extensions.getQName import com.jetbrains.python.psi.PyClass import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SECTION_ACCESSOR_CLASSES -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SECTION_ACCESSOR_CLASSES +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.inspections.SnakemakeInspection import com.jetbrains.snakecharm.inspections.smksl.SmkSLUndeclaredSectionInspectionUtil.checkIsSectionNameUnresolved import com.jetbrains.snakecharm.inspections.smksl.SmkSLUndeclaredSectionInspectionUtil.isSectionNameOfInterest @@ -22,7 +22,7 @@ class SmkSLUndeclaredSectionInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession, ) = object : SmkSLInspectionVisitor(holder, getContext(session)) { - val api = SnakemakeAPIProjectService.getInstance(holder.project) + val api = SnakemakeApiService.getInstance(holder.project) override fun visitSmkSLReferenceExpression(expr: SmkSLReferenceExpression) { val ref = expr.reference @@ -66,6 +66,6 @@ object SmkSLUndeclaredSectionInspectionUtil { } } - fun isSectionNameOfInterest(referencedName: String?, contextKeyword: String?, api: SnakemakeAPIProjectService) = + fun isSectionNameOfInterest(referencedName: String?, contextKeyword: String?, api: SnakemakeApiService) = api.isSubsectionAccessibleAsPlaceholder(referencedName, contextKeyword) } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/inspections/smksl/SmkSLWildcardNameIsConfusingInspection.kt b/src/main/kotlin/com/jetbrains/snakecharm/inspections/smksl/SmkSLWildcardNameIsConfusingInspection.kt index fe030078..7828cf8e 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/inspections/smksl/SmkSLWildcardNameIsConfusingInspection.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/inspections/smksl/SmkSLWildcardNameIsConfusingInspection.kt @@ -5,7 +5,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.jetbrains.python.inspections.quickfix.PyRenameElementQuickFix import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.inspections.SnakemakeInspection import com.jetbrains.snakecharm.stringLanguage.lang.psi.SmkSLReferenceExpression import com.jetbrains.snakecharm.stringLanguage.lang.psi.references.SmkSLWildcardReference @@ -16,7 +16,7 @@ class SmkSLWildcardNameIsConfusingInspection : SnakemakeInspection() { isOnTheFly: Boolean, session: LocalInspectionToolSession, ) = object : SmkSLInspectionVisitor(holder, getContext(session)) { - val api = SnakemakeAPIProjectService.getInstance(holder.project) + val api = SnakemakeApiService.getInstance(holder.project) override fun visitSmkSLReferenceExpression(expr: SmkSLReferenceExpression) { // expr.isQualified: 'wildcards' in 'wildcards.input' diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/SnakemakeNames.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/SnakemakeNames.kt index e5f9ac7b..794cf9a8 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/SnakemakeNames.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/SnakemakeNames.kt @@ -73,7 +73,7 @@ object SnakemakeNames { * Constant that holds the module name for Snakemake input/output operations. * It is used as part of the code insight and symbol resolution process within the Snakemake plugin. * - * For more details, refer to the class `com.jetbrains.snakecharm.codeInsight.ImplicitPySymbolsProvider`. + * For more details, refer to the class `com.jetbrains.snakecharm.codeInsight.SmkImplicitPySymbolsProvider`. */ const val SNAKEMAKE_MODULE_NAME_IO = "snakemake.io" const val SNAKEMAKE_FQN_FUN_MIN_VERSION = "snakemake.utils.min_version" diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeLexer.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeLexer.kt index f2a33138..fff90793 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeLexer.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeLexer.kt @@ -7,7 +7,7 @@ import com.jetbrains.python.PyTokenTypes import com.jetbrains.python.PythonDialectsTokenSetProvider import com.jetbrains.python.lexer.PythonIndentingLexer import com.jetbrains.python.psi.PyElementType -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.TOPLEVEL_ARGS_SECTION_KEYWORDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.TOPLEVEL_ARGS_SECTION_KEYWORDS import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.parser.SmkTokenTypes.WORKFLOW_TOPLEVEL_ARGS_SECTION_KEYWORD diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkPepConfigCollector.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkPepConfigCollector.kt index 91e2a2c4..1c4e8a1a 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkPepConfigCollector.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkPepConfigCollector.kt @@ -3,7 +3,7 @@ //import com.intellij.psi.PsiElement //import com.intellij.psi.PsiFile //import com.jetbrains.rd.util.getOrCreate -//import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI +//import com.jetbrains.snakecharm.codeInsight.SnakemakeApi //import org.jetbrains.yaml.psi.YAMLFile //import org.jetbrains.yaml.psi.YAMLMapping // @@ -22,8 +22,8 @@ // val resultKeys = keys.asSequence().filter { key -> // val keyName = key.text // val keyType = key.parent.lastChild -// !(keyName in SnakemakeAPI.PEPPY_CONFIG_TEXT_KEYS && keyType is YAMLMapping || -// keyName in SnakemakeAPI.PEPPY_CONFIG_MAPPING_KEYS && keyType !is YAMLMapping) +// !(keyName in SnakemakeApi.PEPPY_CONFIG_TEXT_KEYS && keyType is YAMLMapping || +// keyName in SnakemakeApi.PEPPY_CONFIG_MAPPING_KEYS && keyType !is YAMLMapping) // }.toList() // return yamlFile to resultKeys // } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkRuleOrCheckpoint.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkRuleOrCheckpoint.kt index 5e3dd823..cd08efbb 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkRuleOrCheckpoint.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkRuleOrCheckpoint.kt @@ -1,7 +1,7 @@ package com.jetbrains.snakecharm.lang.psi import com.jetbrains.python.psi.PyTypedElement -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.WILDCARDS_DEFINING_SECTIONS_KEYWORDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.WILDCARDS_DEFINING_SECTIONS_KEYWORDS import com.jetbrains.snakecharm.lang.psi.impl.SmkWildcardFakePsiElement interface SmkRuleOrCheckpoint : SmkRuleLike, diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkWildcardsCollector.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkWildcardsCollector.kt index b96d7cd6..fdb82df2 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkWildcardsCollector.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkWildcardsCollector.kt @@ -6,8 +6,8 @@ import com.intellij.psi.PsiElement import com.intellij.psi.util.PsiTreeUtil import com.intellij.psi.util.parentOfType import com.jetbrains.python.psi.* -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.FUNCTIONS_BANNED_FOR_WILDCARDS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.WILDCARDS_DEFINING_SECTIONS_KEYWORDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.FUNCTIONS_BANNED_FOR_WILDCARDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.WILDCARDS_DEFINING_SECTIONS_KEYWORDS import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.stringLanguage.lang.callSimpleName import com.jetbrains.snakecharm.stringLanguage.lang.psi.SmkSLFile diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleImpl.kt index f598adc5..0b6542a3 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleImpl.kt @@ -6,7 +6,7 @@ import com.jetbrains.python.psi.PyElementVisitor import com.jetbrains.python.psi.PyTypedElement import com.jetbrains.python.psi.types.PyType import com.jetbrains.python.psi.types.TypeEvalContext -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi import com.jetbrains.snakecharm.codeInsight.resolve.SmkFakePsiElement import com.jetbrains.snakecharm.lang.parser.SmkTokenTypes import com.jetbrains.snakecharm.lang.psi.SmkElementVisitor @@ -43,7 +43,7 @@ class SmkRuleImpl } class SmkWildcardFakePsiElement(val element: SmkRuleOrCheckpoint): SmkFakePsiElement( - element, SnakemakeAPI.SMK_VARS_WILDCARDS, PlatformIcons.PARAMETER_ICON + element, SnakemakeApi.SMK_VARS_WILDCARDS, PlatformIcons.PARAMETER_ICON ), PyTypedElement { override fun getType(typeEvalContext: TypeEvalContext, key: TypeEvalContext.Key): PyType = SmkWildcardsType(element) } \ No newline at end of file diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt index de5e2116..010407cf 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt @@ -10,8 +10,8 @@ import com.jetbrains.python.psi.PyExpression import com.jetbrains.python.psi.PyLambdaExpression import com.jetbrains.python.psi.PyStringLiteralExpression import com.jetbrains.python.psi.types.TypeEvalContext -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.WILDCARDS_DEFINING_SECTIONS_KEYWORDS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.WILDCARDS_DEFINING_SECTIONS_KEYWORDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.psi.* import com.jetbrains.snakecharm.lang.psi.types.SmkRuleLikeSectionArgsType @@ -80,7 +80,7 @@ open class SmkRuleOrCheckpointArgsSectionImpl(node: ASTNode) : SmkArgsSectionImp } override val isWildcardsExpandingSection by lazy { - SnakemakeAPIProjectService.getInstance(this.project).isSubsectionWildcardsExpanding( + SnakemakeApiService.getInstance(this.project).isSubsectionWildcardsExpanding( sectionKeyword, getParentRuleOrCheckPoint().sectionKeyword ) } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt index 4dda4f50..1abb9e9e 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt @@ -4,8 +4,8 @@ import com.intellij.lang.ASTNode import com.jetbrains.python.psi.PyElementVisitor import com.jetbrains.python.psi.types.PyType import com.jetbrains.python.psi.types.TypeEvalContext -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.WILDCARDS_DEFINING_SECTIONS_KEYWORDS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.WILDCARDS_DEFINING_SECTIONS_KEYWORDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.SnakemakeNames import com.jetbrains.snakecharm.lang.psi.SmkElementVisitor import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection @@ -28,7 +28,7 @@ class SmkUseArgsSectionImpl(node: ASTNode) : SmkArgsSectionImpl(node), SmkRuleOr SmkRuleLikeSectionArgsType(this) override val isWildcardsExpandingSection by lazy { - SnakemakeAPIProjectService.getInstance(this.project).isSubsectionWildcardsExpanding( + SnakemakeApiService.getInstance(this.project).isSubsectionWildcardsExpanding( sectionKeyword, SnakemakeNames.USE_KEYWORD ) } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/AbstractSmkRuleOrCheckpointType.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/AbstractSmkRuleOrCheckpointType.kt index a4f14554..cb55218b 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/AbstractSmkRuleOrCheckpointType.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/AbstractSmkRuleOrCheckpointType.kt @@ -22,7 +22,7 @@ import com.jetbrains.python.psi.PyExpression import com.jetbrains.python.psi.resolve.PyResolveContext import com.jetbrains.python.psi.resolve.RatedResolveResult import com.jetbrains.python.psi.types.PyType -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi import com.jetbrains.snakecharm.codeInsight.completion.SmkCompletionUtil import com.jetbrains.snakecharm.codeInsight.resolve.SmkResolveUtil import com.jetbrains.snakecharm.lang.psi.* @@ -71,7 +71,7 @@ abstract class AbstractSmkRuleOrCheckpointType( location.originalElement, name, indexKey, clazz ) { currentFileDeclarations } - if (location.text == SnakemakeAPI.SMK_VARS_RULES) { + if (location.text == SnakemakeApi.SMK_VARS_RULES) { results += findAvailableRuleLikeElementByName( location.originalElement, name, diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkCheckpointType.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkCheckpointType.kt index 55b71f55..1f989a19 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkCheckpointType.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkCheckpointType.kt @@ -2,7 +2,7 @@ package com.jetbrains.snakecharm.lang.psi.types import com.jetbrains.python.psi.PyExpression import com.jetbrains.python.psi.resolve.RatedResolveResult -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_VARS_CHECKPOINTS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_VARS_CHECKPOINTS import com.jetbrains.snakecharm.lang.psi.SmkCheckPoint import com.jetbrains.snakecharm.lang.psi.SmkFile import com.jetbrains.snakecharm.lang.psi.stubs.SmkCheckpointNameIndexCompanion.KEY diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkPepConfigType.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkPepConfigType.kt index b3a06636..9c61a41b 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkPepConfigType.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkPepConfigType.kt @@ -11,7 +11,7 @@ //import com.jetbrains.python.psi.resolve.PyResolveContext //import com.jetbrains.python.psi.resolve.RatedResolveResult //import com.jetbrains.python.psi.types.PyStructuralType -//import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI +//import com.jetbrains.snakecharm.codeInsight.SnakemakeApi //import com.jetbrains.snakecharm.codeInsight.completion.SmkCompletionUtil //import com.jetbrains.snakecharm.codeInsight.resolve.SmkResolveUtil //import com.jetbrains.snakecharm.lang.psi.SmkFile @@ -82,17 +82,17 @@ // val yamlParseResult = SmkPepConfigCollector.getYamlParseResult(smkFile) // yamlParseResult.second.forEach { key -> // val keyName = key.text -// if (keyName == SnakemakeAPI.PEPPY_CONFIG_PEP_VERSION) containPepVersion = true +// if (keyName == SnakemakeApi.PEPPY_CONFIG_PEP_VERSION) containPepVersion = true // if (isSubscriptionForm || -// keyName in SnakemakeAPI.PEPPY_CONFIG_TEXT_KEYS || -// keyName in SnakemakeAPI.PEPPY_CONFIG_MAPPING_KEYS || +// keyName in SnakemakeApi.PEPPY_CONFIG_TEXT_KEYS || +// keyName in SnakemakeApi.PEPPY_CONFIG_MAPPING_KEYS || // KEY_NAME_PATTERN.matches(keyName) // ) resultList.add(key to keyName) // } // if (!containPepVersion && yamlParseResult.first != null) { // resultList.add( // yamlParseResult.first!! to -// SnakemakeAPI.PEPPY_CONFIG_PEP_VERSION +// SnakemakeApi.PEPPY_CONFIG_PEP_VERSION // ) // } // return resultList diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRuleLikeSectionArgsType.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRuleLikeSectionArgsType.kt index 7837c941..b11619ef 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRuleLikeSectionArgsType.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRuleLikeSectionArgsType.kt @@ -13,7 +13,7 @@ import com.jetbrains.python.psi.resolve.PyResolveContext import com.jetbrains.python.psi.resolve.RatedResolveResult import com.jetbrains.python.psi.types.PyStructuralType import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.UNPACK_FUNCTION +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.UNPACK_FUNCTION import com.jetbrains.snakecharm.codeInsight.completion.SmkCompletionUtil import com.jetbrains.snakecharm.codeInsight.resolve.SmkResolveUtil import com.jetbrains.snakecharm.lang.SnakemakeNames diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRuleLikeSectionType.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRuleLikeSectionType.kt index 98f0f41f..5a8667b0 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRuleLikeSectionType.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRuleLikeSectionType.kt @@ -9,7 +9,7 @@ import com.jetbrains.python.psi.PyStatement import com.jetbrains.python.psi.resolve.PyResolveContext import com.jetbrains.python.psi.resolve.RatedResolveResult import com.jetbrains.python.psi.types.PyType -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.codeInsight.completion.SmkCompletionUtil import com.jetbrains.snakecharm.codeInsight.resolve.SmkResolveUtil import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpoint @@ -54,7 +54,7 @@ class SmkRuleLikeSectionType(private val declaration: SmkRuleOrCheckpoint) : PyT } private fun getAccessibleStatements(): List { - val api = SnakemakeAPIProjectService.getInstance(declaration.project) + val api = SnakemakeApiService.getInstance(declaration.project) val contextKeyword = declaration.sectionKeyword return declaration.statementList.statements.filter { st -> diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRulesType.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRulesType.kt index 59e5e87e..dca67921 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRulesType.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkRulesType.kt @@ -1,6 +1,6 @@ package com.jetbrains.snakecharm.lang.psi.types -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_VARS_RULES +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_VARS_RULES import com.jetbrains.snakecharm.lang.psi.SmkFile import com.jetbrains.snakecharm.lang.psi.SmkRule import com.jetbrains.snakecharm.lang.psi.stubs.SmkRuleNameIndexCompanion.KEY diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/validation/SmkSyntaxErrorAnnotator.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/validation/SmkSyntaxErrorAnnotator.kt index d9a2d7c1..8d56eb50 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/validation/SmkSyntaxErrorAnnotator.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/validation/SmkSyntaxErrorAnnotator.kt @@ -4,7 +4,7 @@ import com.intellij.lang.annotation.HighlightSeverity.ERROR import com.jetbrains.python.psi.PyKeywordArgument import com.jetbrains.python.psi.PyStarArgument import com.jetbrains.snakecharm.SnakemakeBundle -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.inspections.quickfix.IntroduceKeywordArgument import com.jetbrains.snakecharm.lang.SnakemakeLanguageDialect import com.jetbrains.snakecharm.lang.psi.* @@ -64,7 +64,7 @@ object SmkSyntaxErrorAnnotator : SmkAnnotator() { private fun checkMultipleExecutionSections(ruleOrCheckpoint: SmkRuleOrCheckpoint) { var seenExecutionSection: String? = null - val api = SnakemakeAPIProjectService.getInstance(ruleOrCheckpoint.project) + val api = SnakemakeApiService.getInstance(ruleOrCheckpoint.project) val sections = ruleOrCheckpoint.getSections() for (st in sections) { when (st) { diff --git a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/SmkSLInjector.kt b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/SmkSLInjector.kt index 79f72a2d..6751691f 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/SmkSLInjector.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/SmkSLInjector.kt @@ -6,8 +6,8 @@ import com.intellij.psi.util.PsiTreeUtil import com.jetbrains.python.codeInsight.PyInjectionUtil.InjectionResult import com.jetbrains.python.codeInsight.PyInjectorBase import com.jetbrains.python.psi.* -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_FUN_EXPAND -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_FUN_EXPAND +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.SnakemakeLanguageDialect import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection import com.jetbrains.snakecharm.lang.psi.SmkRunSection @@ -43,7 +43,7 @@ open class SmkSLInjector : PyInjectorBase() { } private fun PsiElement.isInValidCallExpression(): Boolean { - val api = SnakemakeAPIProjectService.getInstance(project) + val api = SnakemakeApiService.getInstance(project) val parentCallExpr = PsiTreeUtil.getParentOfType(this, PyCallExpression::class.java) val fqn = (parentCallExpr?.callee?.reference?.resolve() as? PyQualifiedNameOwner)?.qualifiedName @@ -67,7 +67,7 @@ open class SmkSLInjector : PyInjectorBase() { val context = parentSection.getParentRuleOrCheckPoint().sectionKeyword val sectionKeyword = parentSection.sectionKeyword if (context != null && sectionKeyword != null) { - val apiService = SnakemakeAPIProjectService.getInstance(project) + val apiService = SnakemakeApiService.getInstance(project) return apiService.isSubsectionValidForInjection(sectionKeyword, context) } } diff --git a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpressionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpressionImpl.kt index 4d3148f5..785e2a00 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpressionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/SmkSLReferenceExpressionImpl.kt @@ -13,7 +13,7 @@ import com.jetbrains.python.psi.impl.references.PyQualifiedReference import com.jetbrains.python.psi.resolve.PyResolveContext import com.jetbrains.python.psi.types.PyType import com.jetbrains.python.psi.types.TypeEvalContext -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.FUNCTIONS_BANNED_FOR_WILDCARDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.FUNCTIONS_BANNED_FOR_WILDCARDS import com.jetbrains.snakecharm.lang.psi.SmkRuleOrCheckpointArgsSection import com.jetbrains.snakecharm.lang.psi.types.SmkWildcardsType import com.jetbrains.snakecharm.stringLanguage.lang.SmkSLElementVisitor diff --git a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/references/SmkSLInitialReference.kt b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/references/SmkSLInitialReference.kt index 2ffd5395..aad8d64a 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/references/SmkSLInitialReference.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/stringLanguage/lang/psi/references/SmkSLInitialReference.kt @@ -16,10 +16,10 @@ import com.jetbrains.python.psi.resolve.* import com.jetbrains.python.psi.types.TypeEvalContext import com.jetbrains.snakecharm.SnakemakeBundle import com.jetbrains.snakecharm.codeInsight.ImplicitPySymbolUsageType -import com.jetbrains.snakecharm.codeInsight.ImplicitPySymbolsProvider +import com.jetbrains.snakecharm.codeInsight.SmkImplicitPySymbolsProvider import com.jetbrains.snakecharm.codeInsight.SmkCodeInsightScope -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPI.SMK_VARS_WILDCARDS -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApi.SMK_VARS_WILDCARDS +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.codeInsight.completion.SmkCompletionUtil import com.jetbrains.snakecharm.codeInsight.completion.SmkCompletionVariantsProcessor import com.jetbrains.snakecharm.codeInsight.resolve.SmkImplicitPySymbolsResolveProviderCompanion @@ -37,7 +37,7 @@ class SmkSLInitialReference( private val parentDeclaration: SmkRuleOrCheckpoint?, context: PyResolveContext?, ) : PyQualifiedReference(expr, context), SmkSLBaseReference { - val apiService = SnakemakeAPIProjectService.getInstance(expr.project) + val apiService = SnakemakeApiService.getInstance(expr.project) override fun getElement() = myElement as SmkSLReferenceExpression @@ -77,7 +77,7 @@ class SmkSLInitialReference( // Implicit Symbols val contextScope = getSmkScopeForInjection(host) - val cache = ImplicitPySymbolsProvider.instance(element.project).cache + val cache = SmkImplicitPySymbolsProvider.instance(element.project).cache SmkImplicitPySymbolsResolveProviderCompanion.addSyntheticSymbols(contextScope, cache, referencedName, ret) @@ -172,7 +172,7 @@ class SmkSLInitialReference( // perhaps processor should be from 'element', not clear val implicitsProcessor = SmkCompletionVariantsProcessor(host) - val cache = ImplicitPySymbolsProvider.instance(element.project).cache + val cache = SmkImplicitPySymbolsProvider.instance(element.project).cache SmkCodeInsightScope.entries.forEach { symbolScope -> if (contextScope.includes(symbolScope)) { variants.addAll(cache.getSynthetic(symbolScope)) @@ -238,7 +238,7 @@ class SmkSLInitialReference( return emptySequence() } - val api = SnakemakeAPIProjectService.getInstance(parentDeclaration.project) + val api = SnakemakeApiService.getInstance(parentDeclaration.project) val contextKeyword = parentDeclaration.sectionKeyword return parentDeclaration.statementList.statements .asSequence() diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 585b8f9f..fac6aa54 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -665,7 +665,7 @@ - + diff --git a/src/test/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeParsingTest.kt b/src/test/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeParsingTest.kt index 0c67f0b7..49ae9891 100644 --- a/src/test/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeParsingTest.kt +++ b/src/test/kotlin/com/jetbrains/snakecharm/lang/parser/SnakemakeParsingTest.kt @@ -13,7 +13,7 @@ import com.jetbrains.python.psi.impl.PyPsiFacadeImpl import com.jetbrains.python.psi.impl.PythonASTFactory import com.jetbrains.python.psi.impl.PythonLanguageLevelPusher import com.jetbrains.snakecharm.SnakemakeTestUtil -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.lang.SmkTokenSetContributor import com.jetbrains.snakecharm.lang.SnakemakeLanguageDialect @@ -54,7 +54,7 @@ class SnakemakeParsingTest : ParsingTestCase( PyPsiFacadeImpl::class.java ) project.registerService( - SnakemakeAPIProjectService::class.java, + SnakemakeApiService::class.java, ) application.registerService(PyElementTypesFacade::class.java, PyElementTypesFacadeImpl::class.java) application.registerService(PyLanguageFacade::class.java, PyLanguageFacadeImpl::class.java) diff --git a/src/test/kotlin/features/glue/ActionsSteps.kt b/src/test/kotlin/features/glue/ActionsSteps.kt index 2cd98c94..c6f9a9af 100644 --- a/src/test/kotlin/features/glue/ActionsSteps.kt +++ b/src/test/kotlin/features/glue/ActionsSteps.kt @@ -27,7 +27,7 @@ import com.intellij.psi.PsiFile import com.intellij.util.IncorrectOperationException import com.intellij.util.containers.ContainerUtil import com.jetbrains.snakecharm.FakeSnakemakeInjector -import com.jetbrains.snakecharm.codeInsight.SnakemakeAPIProjectService +import com.jetbrains.snakecharm.codeInsight.SnakemakeApiService import com.jetbrains.snakecharm.codeInsight.completion.wrapper.SmkWrapperCrawler import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings import com.jetbrains.snakecharm.inspections.SmkUnrecognizedSectionInspection @@ -632,7 +632,7 @@ class ActionsSteps { FileDocumentManager.getInstance().getDocument(it)!!.text } ?: "" - val api = SnakemakeAPIProjectService.getInstance(fixture.project) + val api = SnakemakeApiService.getInstance(fixture.project) val info = SmkWrapperCrawler.collectWrapperInfo( "wrapper", wrapperFileContent, ext, metaYamlContent, api.getRuleOrCheckpointArgsSectionKeywords() ) diff --git a/src/test/kotlin/features/glue/FilesSteps.kt b/src/test/kotlin/features/glue/FilesSteps.kt index bb796975..1b6b10d0 100644 --- a/src/test/kotlin/features/glue/FilesSteps.kt +++ b/src/test/kotlin/features/glue/FilesSteps.kt @@ -4,7 +4,7 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.ModalityState import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.util.text.StringUtil -import com.jetbrains.snakecharm.framework.SnakemakeFrameworkAPIProvider +import com.jetbrains.snakecharm.framework.SnakemakeApiYamlAnnotationsService import com.jetbrains.snakecharm.lang.highlighter.SmkColorSettingsPage import io.cucumber.java.en.Given import io.cucumber.java.en.Then @@ -38,7 +38,7 @@ class FilesSteps { @Given("snakemake framework api yaml descriptor is$") fun snakemakeFrameworkApiInfoContent(text: String) { ApplicationManager.getApplication().invokeAndWait({ - SnakemakeFrameworkAPIProvider.getInstance().reinitializeInTests(text.byteInputStream()) + SnakemakeApiYamlAnnotationsService.getInstance().reinitializeInTests(text.byteInputStream()) }, ModalityState.nonModal()) } diff --git a/src/test/kotlin/features/glue/StepDefs.kt b/src/test/kotlin/features/glue/StepDefs.kt index 2a15b0e9..4cfd5ddf 100644 --- a/src/test/kotlin/features/glue/StepDefs.kt +++ b/src/test/kotlin/features/glue/StepDefs.kt @@ -17,7 +17,7 @@ import com.jetbrains.python.fixtures.PyLightProjectDescriptor import com.jetbrains.python.psi.LanguageLevel import com.jetbrains.python.psi.PyFile import com.jetbrains.snakecharm.SnakemakeTestUtil -import com.jetbrains.snakecharm.framework.SnakemakeFrameworkAPIProvider +import com.jetbrains.snakecharm.framework.SnakemakeApiYamlAnnotationsService import com.jetbrains.snakecharm.framework.SmkSupportProjectSettings import io.cucumber.java.en.Given import javax.swing.SwingUtilities @@ -135,7 +135,7 @@ class StepDefs { // XXX: reset Snakemake API settings if smth was overridden in other tests ApplicationManager.getApplication().invokeAndWait { ApplicationManager.getApplication().runWriteAction { - SnakemakeFrameworkAPIProvider.getInstance().reinitializeInTests() + SnakemakeApiYamlAnnotationsService.getInstance().reinitializeInTests() } } setProjectSdk("python with snakemake")