Skip to content

Commit

Permalink
Intellij 2024.3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
m0rkeulv committed Nov 17, 2024
1 parent f2cd36f commit 8fd41af
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 37 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog
## 1.5.12
* Changed: support for intellij 2024.3 & dropping support for 2023.x
* Bugfix: Errors where not navigable when OpenFL project file was outside module dir (Fixed by fstrace4)
* Bugfix: Function types for inherited methods could in some cases show wrong signature when type parameters where used.
* Bugfix: Auto-completion would in some cases show wrong types when type parameters where used.
* Bugfix: Fix NPE when evaluating callExpression made out of reifications
Expand Down
5 changes: 2 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.jetbrains.plugin.structure.intellij.problems.ignore
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.grammarkit.tasks.GenerateLexerTask
Expand All @@ -15,9 +14,9 @@ plugins {
// Java support
id("java")
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "1.9.21"
id("org.jetbrains.kotlin.jvm") version "2.0.21"
// Gradle IntelliJ Plugin
id("org.jetbrains.intellij.platform") version "2.0.0-rc1"
id("org.jetbrains.intellij.platform") version "2.1.0"
// Gradle Changelog Plugin
id("org.jetbrains.changelog") version "2.0.0"
// Gradle Qodana Plugin
Expand Down
27 changes: 20 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pluginName = Haxe Toolkit Support
pluginRepositoryUrl = https://github.com/HaxeFoundation/intellij-haxe

# SemVer format -> https://semver.org
pluginVersion = 1.5.11
pluginVersion = 1.5.12

# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
platformType = IU
Expand All @@ -16,26 +16,35 @@ platformType = IU

#run print product releases to see what's the LATEST-EAP-SNAPSHOT
#platformVersion = 242.20224.91
platformVersion = 2024.2.0.1
#platformVersion = 2023.3.7
#platformVersion = 2024.2.1
#platformVersion = 2024.1.2
platformVersion = 2024.3
platformDownloadSources = true

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild = 232
pluginUntilBuild = 242.*
pluginSinceBuild = 241
pluginUntilBuild = 243.*

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
# see flex/flash versions at : https://plugins.jetbrains.com/plugin/14508-flash-flex/versions/stable/252411

# IC 2024.3
#platformBundledPlugins = com.intellij.java, com.intellij.modules.json
#platformPlugins = com.intellij.flex:243.21565.129, OpenGL-Plugin:1.1.3, com.intellij.classic.ui:243.21565.122

# IU 2024.3
platformBundledPlugins = com.intellij.java, com.intellij.modules.json, JavaScript
platformPlugins = com.intellij.flex:243.21565.129, OpenGL-Plugin:1.1.3, com.intellij.classic.ui:243.21565.122

# IC 2024.2.1
#platformBundledPlugins = com.intellij.java
#platformPlugins = com.intellij.flex:242.20224.159, OpenGL-Plugin:1.1.3, com.intellij.classic.ui:242.20224.159

# IU 2024.2.1
platformBundledPlugins = com.intellij.java, JavaScript
platformPlugins = com.intellij.flex:242.20224.159, OpenGL-Plugin:1.1.3, com.intellij.classic.ui:242.20224.159
#platformBundledPlugins = com.intellij.java, JavaScript
#platformPlugins = com.intellij.flex:242.20224.159, OpenGL-Plugin:1.1.3, com.intellij.classic.ui:242.20224.159

# IC 2024.1.4
#platformBundledPlugins = com.intellij.java
Expand All @@ -45,6 +54,10 @@ platformPlugins = com.intellij.flex:242.20224.159, OpenGL-Plugin:1.1.3, com.inte
#platformBundledPlugins = com.intellij.java, JavaScript
#platformPlugins = com.intellij.flex:241.15989.21, OpenGL-Plugin:1.1.2

# IC 2024.1.2
#platformBundledPlugins = com.intellij.java
#platformPlugins = com.intellij.flex:241.15989.21, OpenGL-Plugin:1.1.2,

# IU 2023.3
#platformBundledPlugins = com.intellij.java, JavaScript
#platformPlugins = com.intellij.flex:233.11799.196, OpenGL-Plugin:1.1.2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@ public LimeXmlFileDescription() {
}

@Override
public Icon getFileIcon(@Iconable.IconFlags int flags) {
return HaxeIcons.LIME_LOGO;
public @Nullable Icon getFileIcon(@NotNull XmlFile file, @Iconable.IconFlags int flags) {
if(isLimeFile(file)) {
return HaxeIcons.LIME_LOGO;
}
return null;
}


@Override
public boolean isMyFile(@NotNull XmlFile file, @Nullable Module module) {
return isLimeFile(file);
}

private boolean isLimeFile(@NotNull XmlFile file) {
return LimeOpenFlUtil.isLimeFile(file);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import com.intellij.openapi.module.Module;
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.psi.xml.XmlDocument;
import com.intellij.psi.xml.XmlFile;
import com.intellij.psi.xml.XmlTag;
import icons.HaxeIcons;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.NotNull;
Expand All @@ -18,13 +15,20 @@ public class OpenflXmlFileDescription extends LimeXmlFileDescription {


@Override
public Icon getFileIcon(@Iconable.IconFlags int flags) {
return HaxeIcons.OPENFL_LOGO;
public @Nullable Icon getFileIcon(@NotNull XmlFile file, @Iconable.IconFlags int flags) {
if(isOpenFlFile(file)) {
return HaxeIcons.OPENFL_LOGO;
}
return null;
}


@Override
public boolean isMyFile(@NotNull XmlFile file, @Nullable Module module) {
return isOpenFlFile(file);
}

private boolean isOpenFlFile(@NotNull XmlFile file) {
return LimeOpenFlUtil.isOpenFlFile(file);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,21 @@ public NMMLFileDescription() {
super(ProjectXml.class, ProjectXml.TAG_NAME);
}
@Override
public Icon getFileIcon(@Iconable.IconFlags int flags) {
return HaxeIcons.NMML_LOGO;
public @Nullable Icon getFileIcon(@NotNull XmlFile file, @Iconable.IconFlags int flags) {
if(isNmmlFile(file)) {
return HaxeIcons.NMML_LOGO;
}
return null;
}



@Override
public boolean isMyFile(@NotNull XmlFile file, @Nullable Module module) {
return isNmmlFile(file);
}

private static boolean isNmmlFile(@NotNull XmlFile file) {
XmlDocument document = file.getDocument();
if(document == null) return false;

Expand All @@ -37,5 +44,4 @@ public boolean isMyFile(@NotNull XmlFile file, @Nullable Module module) {

return FileUtilRt.extensionEquals(file.getName(), NMMLFileType.INSTANCE.getDefaultExtension());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.intellij.plugins.haxe.haxelib.HaxelibUtil;
import com.intellij.plugins.haxe.haxelib.ModuleLibraryCache;
import com.intellij.plugins.haxe.ide.module.HaxeModuleType;
import com.intellij.psi.PsiFile;
import com.intellij.psi.xml.XmlFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -76,7 +77,7 @@ protected boolean isVisible(AnActionEvent e) {
}

private static boolean isProjectFile(AnActionEvent e) {
Object file = e.getDataContext().getData("psi.File");
PsiFile file = e.getDataContext().getData(PlatformDataKeys.PSI_FILE);
if (file instanceof XmlFile xmlFile) {
return LimeOpenFlUtil.isLimeFile(xmlFile) || LimeOpenFlUtil.isOpenFlFile(xmlFile);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.intellij.plugins.haxe.haxelib.HaxelibUtil;
import com.intellij.plugins.haxe.haxelib.ModuleLibraryCache;
import com.intellij.plugins.haxe.ide.module.HaxeModuleType;
import com.intellij.psi.PsiFile;
import com.intellij.psi.xml.XmlFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -72,7 +73,7 @@ protected boolean isVisible(AnActionEvent e) {
}

private static boolean isProjectFile(AnActionEvent e) {
Object file = e.getDataContext().getData("psi.File");
PsiFile file = e.getDataContext().getData(PlatformDataKeys.PSI_FILE);
if (file instanceof XmlFile xmlFile) {
return LimeOpenFlUtil.isLimeFile(xmlFile) || LimeOpenFlUtil.isOpenFlFile(xmlFile);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public abstract class LoadProjectActionBase extends AnAction {

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
VirtualFile file = (VirtualFile)e.getDataContext().getData("virtualFile");
VirtualFile file = e.getDataContext().getData(PlatformDataKeys.VIRTUAL_FILE);
performProjectImport(e.getProject(), file);
}

Expand All @@ -42,12 +42,12 @@ protected boolean isVisible(AnActionEvent e) {


private static boolean hasHaxeModuleLoaded(AnActionEvent e) {
Module module = (Module)e.getDataContext().getData("module");
Module module = e.getDataContext().getData(PlatformDataKeys.MODULE);
return module!= null && ModuleType.get(module) == HaxeModuleType.getInstance();
}

private boolean isProjectFile(AnActionEvent e) {
VirtualFile data = (VirtualFile)e.getDataContext().getData("virtualFile");
VirtualFile data = e.getDataContext().getData(PlatformDataKeys.VIRTUAL_FILE);
return isProjectFile(data);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,16 @@ public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
final boolean isNMML = myNmmlFileRadioButton.isSelected();
final boolean isOpenFL = myOpenFLFileRadioButton.isSelected();
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, true, false, false) {
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return super.isFileVisible(file, showHiddenFiles) &&
(file.isDirectory()
|| (!isNMML && !isOpenFL && "hxml".equalsIgnoreCase(file.getExtension()))
|| (isNMML && "nmml".equalsIgnoreCase(file.getExtension()))
|| (isOpenFL && "xml".equalsIgnoreCase(file.getExtension()))
|| (isOpenFL && "lime".equalsIgnoreCase(file.getExtension()))
);
}
};
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, true, false, false)
.withFileFilter((file) -> {
return (file.isDirectory()
|| (!isNMML && !isOpenFL && "hxml".equalsIgnoreCase(file.getExtension()))
|| (isNMML && "nmml".equalsIgnoreCase(file.getExtension()))
|| (isOpenFL && "xml".equalsIgnoreCase(file.getExtension()))
|| (isOpenFL && "lime".equalsIgnoreCase(file.getExtension()))
);
});

final VirtualFile file = FileChooser.chooseFile(descriptor, getMainPanel(), null, ProjectUtil.guessModuleDir(myModule));
if (file != null) {
String path = FileUtil.toSystemIndependentName(file.getPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ protected void doTest(InlayHintsProvider inlayHintsProvider) throws Exception {
//seems to be an issue with windows line endings and inlays so to avoid any issues we replace them here.
data = data.replaceAll("\\r\\n?", "\n");

doTestProvider("testFile.hx", data, inlayHintsProvider, Map.of(), false);
//doTestProvider("testFile.hx", data, inlayHintsProvider, Map.of(), true);
doTestProvider("testFile.hx", data, inlayHintsProvider, Map.of(), null, true);
}
}

0 comments on commit 8fd41af

Please sign in to comment.