Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/#462 gutter icons module case #465

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

dakochik
Copy link
Contributor

New index was implemented, so issues #462 and #463 were resolved

Dmitry and others added 13 commits November 4, 2021 11:59
…harm into features/#429-icon-for-use

� Conflicts:
�	CHANGELOG.md
�	src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkPsiElements.kt
�	src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseImpl.kt
�	src/main/resources/SnakemakeBundle.properties
…harm into features/#429-icon-for-use

� Conflicts:
�	CHANGELOG.md
�	src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkFile.kt
Resolves: #429
Resolves: #429
…er icons in case of overridden rules was changed. Corresponding tests were extended.

Resolves: #462, #463, #429
@dakochik
Copy link
Contributor Author

dakochik commented Jan 29, 2022

Note, that all commits except the last two were taken from #429 so only the fdbdba8 and 6380fa3 are related to this issue

Copy link
Contributor

@iromeo iromeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API cleanup required. Please rebase with master first to get PSI changes

/**
* Stub of rule like element which inherits at least one rule
*/
interface RuleDescendantStub<T : PsiNamedElement> : NamedStub<T> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems it is over-design. We have only one object that could inherit rules (use) and do not have any expectations that there will be more rules with such feature. So intermediate classes and interfaces RuleDescendantStub and RuleDescendantStubImpl have only single implementations and seems to be redundant. I suggest to leave only SmkUseStub and SmkUseStubImpl.

P.S SmkRuleLikeStubImpl is a different case, it hase 4 subclasses.


override fun createStub(name: String?, parentStub: StubElement<*>?): SmkUseStub =
SmkUseStubImpl(name, parentStub)
lateinit var psi: SmkUse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this field? Seems no usages + I consider it to be a nasty hack. It is factory, it shouldn't memorize reference to some of objects created via this factory.

createStub(psi.name, parentStub)
createStub(
psi.name,
psi.getDefinedReferencesOfImportedRuleNames()?.map { it.text } ?: listOf(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get * reference has another meaning, normally reference that is associated with psi element, e.g. PsiElement.getReferences(): PsiRference[]. Please use less confusing naming here. Also I think better will be do not break incapsulation idea of OOP and do smth like use.getImportedNamesList():SmkImportedRulesNamesList? and SmkImportedRulesNamesList.arguments(): SmkReferenceExpression[]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SmkRuleDescendantStub.getInheritedRulesNames() seems should be also method of SmkImportedRulesNamesList.arguments stub.

// We don't save it in stub because it requires 'resolve'
// We compare resolve results even for descendantsDefinedExplicitly
// Because there may be rules with the same names
if (descendant.getImportedRules()?.contains(element) == true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getImportedRules() name sounds to innocent, like some simple filter on AST nodes, similar to other methods. Actually it is heavy method that does resolve. Let's emphasize that it isn't lightweight method and does resolve, e.g name it use.getImportedRules().resolveNames()

@iromeo iromeo assigned dakochik and unassigned iromeo Feb 4, 2022
Dmitry added 4 commits March 28, 2022 14:15
…ub.com/JetBrains-Research/snakecharm into features/#462-gutter-icons-module-case

� Conflicts:
�	CHANGELOG.md
�	src/main/kotlin/com/jetbrains/snakecharm/SnakemakeRuleInheritanceMarkerProvider.kt
�	src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkIgnorePyInspectionExtension.kt
�	src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkNotSameWildcardsSetInspection.kt
�	src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkSeveralRulesAreOverriddenAsOneInspection.kt
�	src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUnresolvedImportedRuleNameInspection.kt
�	src/main/kotlin/com/jetbrains/snakecharm/inspections/SmkUnusedLogFileInspection.kt
�	src/main/kotlin/com/jetbrains/snakecharm/lang/parser/SmkStatementParsing.kt
�	src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkPsiElements.kt
�	src/main/kotlin/com/jetbrains/snakecharm/lang/psi/SmkWildcardsCollector.kt
�	src/main/kotlin/com/jetbrains/snakecharm/lang/psi/elementTypes/SmkElementTypes.kt
�	src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseImpl.kt
�	src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/stubs/SmkUseElementType.kt
�	src/main/kotlin/com/jetbrains/snakecharm/lang/psi/types/SmkWildcardsType.kt
�	testData/psi/Use.txt
�	testData/psi/UseIncomplete.txt
�	testData/psi/UseInvalid.txt
@dakochik
Copy link
Contributor Author

API was cleaned-up

@dakochik dakochik assigned iromeo and unassigned dakochik Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants