eclipse-platform / eclipse-platform/eclipse.platform

The ContentType implementation of IContentType.isAssociatedWith is case insensitive and I find no case sensitive alternative

オープン
#673 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
165
フォーク
174
平均マージ
2日 8時間
マージ済み PR(30日)
22

説明

The ContentType implementation of IContentType.isAssociatedWith is case insensitive which means that if your content type contains .c and the presented file is a .C file ContentType.isAssociatedWith will return true.

There are 2 locations where ContentType.isAssociatedWith uses equalsIgnoreCase
https://github.com/eclipse-platform/eclipse.platform/blob/f385650ab42fb7275ab164643fe2d1db5040750e/runtime/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/FileSpec.java#L53
and
https://github.com/eclipse-platform/eclipse.platform/blob/f385650ab42fb7275ab164643fe2d1db5040750e/runtime/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentType.java#L385

Unfortunately for me .c files are associated with c compilers and .C files are associated with C++ compilers which means CDT can not use ContentType.isAssociatedWith and chose to implemented a private method to provide the functionality.
https://github.com/eclipse-cdt/cdt/blob/7c8bb9f00ef0d5e3ff493bc0c944519a3e476da2/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CContentTypes.java#L130

As I need a case sensitive implementation of IContentType.isAssociatedWith I have the option to make the private method of CDT public or have a solution in (I)ContentType.
I'd prefer the second.

Note 1) I did not find any documentation that says the comparison is case insensitive.
Note 2) I think file name comparison is case insensitive as well.
Note 3) I can create a PR but I need some guidance on what the change should look like.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず runtime/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/FileSpec.java と ContentType.java にある equalsIgnoreCase の使用箇所を読み、次に CDT の CContentTypes.java にある大文字と小文字を区別するロジックと比較します。完了条件は、コンテンツタイプ API が、CDT のプライベートな回避策を必要とせず、文書化された大文字と小文字を区別する関連付けパスを提供することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。