-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
380 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "src/main/resources/fsh/fsh.tmbundle"] | ||
path = src/main/resources/fsh/fsh.tmbundle | ||
url = git@github.com:qligier/fsh.tmbundle.git | ||
url = https://github.com/qligier/fsh.tmbundle.git |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/main/java/ch/qligier/jetbrains/plugin/fhir/fsh/FshTextMateBundleProvider.java
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/main/java/ch/qligier/jetbrains/plugin/fhir/package-info.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
src/main/java/ch/qligier/jetbrains/plugin/fss/common/FssIconProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2024 Quentin Ligier. Use of this source code is governed by the MIT license. | ||
|
||
package ch.qligier.jetbrains.plugin.fss.common; | ||
|
||
import com.intellij.ide.FileIconProvider; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.util.Iconable; | ||
import com.intellij.openapi.vfs.VirtualFile; | ||
import org.jspecify.annotations.NonNull; | ||
import org.jspecify.annotations.Nullable; | ||
|
||
import javax.swing.*; | ||
|
||
/** | ||
* A custom icon provider: it is used to give a better icon to files such as <em>ig.ini</em> and <em>sushi-config | ||
* .yaml</em>. | ||
* | ||
* @author Quentin Ligier | ||
**/ | ||
public class FssIconProvider implements FileIconProvider { | ||
|
||
/** | ||
* Provides a custom icon for the given virtual file, or {@code null} it there is no icon to provide. | ||
* | ||
* @param file The target file. | ||
* @param flags Some flags. | ||
* @param project The project. | ||
* @return an icon to override the default one or {@code null}. | ||
*/ | ||
@Override | ||
public @Nullable Icon getIcon(@NonNull final VirtualFile file, | ||
final @Iconable.IconFlags int flags, | ||
@Nullable final Project project) { | ||
if ("ig.ini".equals(file.getName())) { | ||
return Icons.FHIR_FLAME; | ||
} else if ("sushi-config.yaml".equals(file.getName())) { | ||
return Icons.FSH_FLAME; | ||
} else if (file.getPath().endsWith("/input/includes/menu.xml")) { | ||
return Icons.MENU_XML; | ||
} | ||
return null; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/ch/qligier/jetbrains/plugin/fss/common/Icons.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2024 Quentin Ligier. Use of this source code is governed by the MIT license. | ||
|
||
package ch.qligier.jetbrains.plugin.fss.common; | ||
|
||
import com.intellij.openapi.util.IconLoader; | ||
|
||
import javax.swing.*; | ||
|
||
/** | ||
* The icons used by this plugin. | ||
* | ||
* @author Quentin Ligier | ||
* @see <a href="https://plugins.jetbrains.com/docs/intellij/work-with-icons-and-images.html">Working with Icons and | ||
* Images</a> | ||
* @see <a href="https://jetbrains.design/intellij/principles/icons/">Icons</a> | ||
* @see <a href="https://jetbrains.design/intellij/resources/icons_list/">Icons list</a> | ||
* @see <a href="https://bjansen.github.io/intellij-icon-generator/">IntelliJ Icon Generator</a> | ||
* @see <a href="https://intellij-icons.jetbrains.design">IntelliJ Platform Icons</a> | ||
**/ | ||
public class Icons { | ||
|
||
// 16x16 icon for the language type | ||
public static final Icon FSH_FLAME = IconLoader.getIcon("/icons/fsh_flame.png", Icons.class); | ||
public static final Icon FHIR_FLAME = IconLoader.getIcon("/icons/fhir.png", Icons.class); | ||
public static final Icon MENU_XML = IconLoader.getIcon("/icons/menu.svg", Icons.class); | ||
|
||
/** | ||
* Icons based on <a href="https://jetbrains.design/intellij/resources/icons_list/">JetBrains ones</a>. | ||
*/ | ||
public static final Icon FSH_FILE = IconLoader.getIcon("/icons/fsh_file.svg", Icons.class); | ||
public static final Icon VALUESET = IconLoader.getIcon("/icons/valueset.svg", Icons.class); | ||
public static final Icon PROFILE = IconLoader.getIcon("/icons/profile.svg", Icons.class); | ||
public static final Icon EXTENSION = IconLoader.getIcon("/icons/extension.svg", Icons.class); | ||
public static final Icon RESOURCE = IconLoader.getIcon("/icons/resource.svg", Icons.class); | ||
public static final Icon MAPPING = IconLoader.getIcon("/icons/mapping.svg", Icons.class); | ||
public static final Icon ALIAS = IconLoader.getIcon("/icons/alias.svg", Icons.class); | ||
public static final Icon LOGICAL = IconLoader.getIcon("/icons/logical.svg", Icons.class); | ||
public static final Icon CODESYSTEM = IconLoader.getIcon("/icons/codesystem.svg", Icons.class); | ||
public static final Icon RULESET = IconLoader.getIcon("/icons/ruleset.svg", Icons.class); | ||
public static final Icon INVARIANT = IconLoader.getIcon("/icons/invariant.svg", Icons.class); | ||
public static final Icon INSTANCE = IconLoader.getIcon("/icons/instance.svg", Icons.class); | ||
} |
59 changes: 59 additions & 0 deletions
59
src/main/java/ch/qligier/jetbrains/plugin/fss/fsh/FshFileType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2024 Quentin Ligier. Use of this source code is governed by the MIT license. | ||
|
||
package ch.qligier.jetbrains.plugin.fss.fsh; | ||
|
||
import ch.qligier.jetbrains.plugin.fss.common.Icons; | ||
import com.intellij.openapi.fileTypes.LanguageFileType; | ||
import org.jspecify.annotations.NonNull; | ||
import org.jspecify.annotations.Nullable; | ||
|
||
import javax.swing.*; | ||
|
||
/** | ||
* Definition of the FSH file type. | ||
* | ||
* @author Quentin Ligier | ||
* @see <a href="https://plugins.jetbrains.com/docs/intellij/language-and-filetype.html">Language and File Type</a> | ||
**/ | ||
public class FshFileType extends LanguageFileType { | ||
public static final FshFileType INSTANCE = new FshFileType(); | ||
|
||
private FshFileType() { | ||
super(FshLanguage.INSTANCE); | ||
} | ||
|
||
/** | ||
* Returns the name of the file type. The name must be unique among all file types registered in the system. | ||
*/ | ||
@Override | ||
public | ||
@NonNull String getName() { | ||
return "FSH"; | ||
} | ||
|
||
/** | ||
* Returns the user-readable description of the file type. | ||
*/ | ||
@Override | ||
public | ||
@NonNull String getDescription() { | ||
return "FSH (SUSHI) file"; | ||
} | ||
|
||
/** | ||
* Returns the default extension for files of the type, <em>not</em> including the leading '.'. | ||
*/ | ||
@Override | ||
public | ||
@NonNull String getDefaultExtension() { | ||
return "fsh"; | ||
} | ||
|
||
/** | ||
* Returns the icon used for showing files of the type, or {@code null} if no icon should be shown. | ||
*/ | ||
@Override | ||
public @Nullable Icon getIcon() { | ||
return Icons.FSH_FILE; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/ch/qligier/jetbrains/plugin/fss/fsh/FshLanguage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2024 Quentin Ligier. Use of this source code is governed by the MIT license. | ||
|
||
package ch.qligier.jetbrains.plugin.fss.fsh; | ||
|
||
import com.intellij.lang.Language; | ||
|
||
/** | ||
* Definition of the FSH language. | ||
* | ||
* @author Quentin Ligier | ||
* @see <a href="https://plugins.jetbrains.com/docs/intellij/language-and-filetype.html">Language and File Type</a> | ||
**/ | ||
public class FshLanguage extends Language { | ||
public static final FshLanguage INSTANCE = new FshLanguage(); | ||
|
||
private FshLanguage() { | ||
super("FSH"); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/ch/qligier/jetbrains/plugin/fss/fsh/FshTextMateBundleProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2024 Quentin Ligier. Use of this source code is governed by the MIT license. | ||
|
||
package ch.qligier.jetbrains.plugin.fss.fsh; | ||
|
||
import com.intellij.openapi.application.PluginPathManager; | ||
import com.intellij.openapi.diagnostic.Logger; | ||
import org.jetbrains.plugins.textmate.api.TextMateBundleProvider; | ||
import org.jspecify.annotations.NonNull; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
/** | ||
* The provider of the FSH TextMate bundle. | ||
* | ||
* @author Quentin Ligier | ||
**/ | ||
public class FshTextMateBundleProvider implements TextMateBundleProvider { | ||
private static final Logger LOG = Logger.getInstance(FshTextMateBundleProvider.class); | ||
|
||
@Override | ||
public @NonNull List<PluginBundle> getBundles() { | ||
final File directory = PluginPathManager.getPluginResource(this.getClass(), "textmate"); | ||
if (directory == null) { | ||
LOG.error("Could not find the FSH TextMate bundle"); | ||
return List.of(); | ||
} | ||
LOG.warn("Found the FSH TextMate bundle at " + directory.getAbsolutePath()); | ||
System.out.println("Found the FSH TextMate bundle at " + directory.getAbsolutePath()); | ||
return List.of(new PluginBundle("FSH", directory.toPath())); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/ch/qligier/jetbrains/plugin/fss/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2024 Quentin Ligier. Use of this source code is governed by the MIT license. | ||
|
||
/** | ||
* The main package of the plugin "FHIR and SUSHI Support" (FSS). | ||
* <p> | ||
* The package is marked with JSpecify's {@code @NullMarked} to ensure that the plugin doesn't contain any null | ||
* pointers. | ||
* | ||
* @author Quentin Ligier | ||
* @see <a href="https://jspecify.dev/docs/user-guide/">Nullness User Guide</a> | ||
* @see <a href="https://jspecify.dev/docs/api/org/jspecify/annotations/NullMarked.html">Annotation Interface | ||
* NullMarked</a> | ||
**/ | ||
@NullMarked | ||
package ch.qligier.jetbrains.plugin.fss; | ||
|
||
import org.jspecify.annotations.NullMarked; |
Oops, something went wrong.