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

Add a case sensitive variant of IContentType.isAssociatedWith #673 #1235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jantje
Copy link

@jantje jantje commented Mar 4, 2024

As discussed in #673
Would something like this be acceptable?
I could not test the change so I do not know this will work yet so please do not yet accept this.
What is the advised way to add tests?

@jukzi jukzi force-pushed the Case_sensitive_contenttype_#673 branch from d023d11 to 9b1f3c0 Compare March 8, 2024 12:33
Copy link
Contributor

github-actions bot commented Mar 8, 2024

Test Results

  424 files   -   212    424 suites   - 212   29m 14s ⏱️ - 10m 46s
3 945 tests ±    0  3 904 ✅  -    18   41 💤 +18  0 ❌ ±0 
8 294 runs   - 4 147  8 179 ✅  - 4 098  115 💤  - 49  0 ❌ ±0 

Results for commit 9b1f3c0. ± Comparison against base commit 31e1ef4.

This pull request skips 18 tests.
org.eclipse.core.tests.resources.regression.Bug_026294 ‑ testDeleteClosedProjectLinux
org.eclipse.core.tests.resources.regression.Bug_026294 ‑ testDeleteFolderLinux
org.eclipse.core.tests.resources.regression.Bug_026294 ‑ testDeleteOpenProjectLinux
org.eclipse.core.tests.resources.regression.Bug_044106 ‑ testDeleteLinkedFile
org.eclipse.core.tests.resources.regression.Bug_044106 ‑ testDeleteLinkedFileKeepHistory
org.eclipse.core.tests.resources.regression.Bug_044106 ‑ testDeleteLinkedFolder
org.eclipse.core.tests.resources.regression.Bug_044106 ‑ testDeleteLinkedFolderKeepHistory
org.eclipse.core.tests.resources.regression.Bug_044106 ‑ testDeleteLinkedFolderParentKeepHistory
org.eclipse.core.tests.resources.regression.Bug_044106 ‑ testDeleteLinkedResourceInProject
org.eclipse.core.tests.resources.regression.Bug_044106 ‑ testDeleteLinkedResourceInProjectKeepHistory
…

Copy link
Contributor

@jukzi jukzi left a comment

Choose a reason for hiding this comment

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

As discussed in #673
Would something like this be acceptable?

maybe @jonahgraham can review as he was involved in the discussion?

What is the advised way to add tests?

Copy and paste existing tests and adapt them. I typically find related tests in the call hierarchy.

Copy link
Contributor

@merks merks left a comment

Choose a reason for hiding this comment

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

I'm not sure the deprecations in the API are necessary or helpful. They're certainly not properly documented.

* @see #isAssociatedWith(String, IScopeContext)
*/
@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

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

If you deprecate it, there should be javadoc explaining what to use instead.

I wonder though, why deprecate it instead of having a default method that calls the new method with true, which has been the behavior of the past? But then, you've deprecated two methods and replaced them with a single method, so if I have a string but not a scope context, what will I do to fix the deprecation warning?

* @since 3.1
*/
@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

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

If you deprecate it, there should be javadoc explaining what to use instead.

@mickaelistria
Copy link
Contributor

What would be responsible of defining whether we want caseStrict or not? Some global preference? A flag in the extension point?

@merks
Copy link
Contributor

merks commented Aug 15, 2024

What would be responsible of defining whether we want caseStrict or not? Some global preference? A flag in the extension point?

That's also a very good question! I see these callers:

image
image

But that's mostly in the type hierarchy. It's not at all clear how the following usage would decide true versus false and in fact there isn't good non-deprecated method for it to call:

image

I would have expect the flag to be defined by the content type provider/definition such that this decision is not even something you see in the API. I.e., just because CDT wants .c and .C to be the same, doesn't mean JDT should also .Java, .JaVa, and all variations there of...

@@ -377,15 +392,15 @@ boolean hasBuiltInAssociations() {
return builtInAssociations;
}

boolean hasFileSpec(IScopeContext context, String text, int typeMask) {
boolean hasFileSpec(IScopeContext context, String text, int typeMask, boolean caseStrict) {
Copy link
Contributor

Choose a reason for hiding this comment

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

As we already have a typeMask, why not having a new flag controlling the behavior?

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.

5 participants