lime display: if the project file is newer than an existing debug/release/final.hxml file, don't consider the .hxml file valid anymore
Code intelligence should always use the newest hxml content, so the fallback mode where the hxml content is generated, instead of loaded from an existing .hxml file, should be used when the project file is newer. For instance, if the user changes any file/dir paths in their project file, continuing to use the existing .hxml file could lead to confusing error messages that still reference the old/cached file paths. It should always use the latest paths or other values from the project file. It should be considered a bug to use the old cached paths. Previously, as a workaround, the user would need to clean or build their project again to get updated .hxml files. It might also require restarting their editor/IDE too. Bad developer experience when we can detect this case automatically.
This commit is contained in:
@@ -294,7 +294,12 @@ class AndroidPlatform extends PlatformTarget
|
||||
{
|
||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||
|
||||
if (FileSystem.exists(path))
|
||||
// try to use the existing .hxml file. however, if the project file was
|
||||
// modified more recently than the .hxml, then the .hxml cannot be
|
||||
// considered valid anymore. it may cause errors in editors like vscode.
|
||||
if (FileSystem.exists(path)
|
||||
&& (project.projectFilePath == null || !FileSystem.exists(project.projectFilePath)
|
||||
|| (FileSystem.stat(path).mtime.getTime() > FileSystem.stat(project.projectFilePath).mtime.getTime())))
|
||||
{
|
||||
return File.getContent(path);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,12 @@ class FlashPlatform extends PlatformTarget
|
||||
{
|
||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||
|
||||
if (FileSystem.exists(path))
|
||||
// try to use the existing .hxml file. however, if the project file was
|
||||
// modified more recently than the .hxml, then the .hxml cannot be
|
||||
// considered valid anymore. it may cause errors in editors like vscode.
|
||||
if (FileSystem.exists(path)
|
||||
&& (project.projectFilePath == null || !FileSystem.exists(project.projectFilePath)
|
||||
|| (FileSystem.stat(path).mtime.getTime() > FileSystem.stat(project.projectFilePath).mtime.getTime())))
|
||||
{
|
||||
return File.getContent(path);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,12 @@ class HTML5Platform extends PlatformTarget
|
||||
{
|
||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||
|
||||
if (FileSystem.exists(path))
|
||||
// try to use the existing .hxml file. however, if the project file was
|
||||
// modified more recently than the .hxml, then the .hxml cannot be
|
||||
// considered valid anymore. it may cause errors in editors like vscode.
|
||||
if (FileSystem.exists(path)
|
||||
&& (project.projectFilePath == null || !FileSystem.exists(project.projectFilePath)
|
||||
|| (FileSystem.stat(path).mtime.getTime() > FileSystem.stat(project.projectFilePath).mtime.getTime())))
|
||||
{
|
||||
return File.getContent(path);
|
||||
}
|
||||
|
||||
@@ -456,7 +456,12 @@ class IOSPlatform extends PlatformTarget
|
||||
{
|
||||
var path = targetDirectory + "/" + project.app.file + "/haxe/Build.hxml";
|
||||
|
||||
if (FileSystem.exists(path))
|
||||
// try to use the existing .hxml file. however, if the project file was
|
||||
// modified more recently than the .hxml, then the .hxml cannot be
|
||||
// considered valid anymore. it may cause errors in editors like vscode.
|
||||
if (FileSystem.exists(path)
|
||||
&& (project.projectFilePath == null || !FileSystem.exists(project.projectFilePath)
|
||||
|| (FileSystem.stat(path).mtime.getTime() > FileSystem.stat(project.projectFilePath).mtime.getTime())))
|
||||
{
|
||||
return File.getContent(path);
|
||||
}
|
||||
|
||||
@@ -362,7 +362,12 @@ class LinuxPlatform extends PlatformTarget
|
||||
{
|
||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||
|
||||
if (FileSystem.exists(path))
|
||||
// try to use the existing .hxml file. however, if the project file was
|
||||
// modified more recently than the .hxml, then the .hxml cannot be
|
||||
// considered valid anymore. it may cause errors in editors like vscode.
|
||||
if (FileSystem.exists(path)
|
||||
&& (project.projectFilePath == null || !FileSystem.exists(project.projectFilePath)
|
||||
|| (FileSystem.stat(path).mtime.getTime() > FileSystem.stat(project.projectFilePath).mtime.getTime())))
|
||||
{
|
||||
return File.getContent(path);
|
||||
}
|
||||
|
||||
@@ -341,7 +341,12 @@ class MacPlatform extends PlatformTarget
|
||||
{
|
||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||
|
||||
if (FileSystem.exists(path))
|
||||
// try to use the existing .hxml file. however, if the project file was
|
||||
// modified more recently than the .hxml, then the .hxml cannot be
|
||||
// considered valid anymore. it may cause errors in editors like vscode.
|
||||
if (FileSystem.exists(path)
|
||||
&& (project.projectFilePath == null || !FileSystem.exists(project.projectFilePath)
|
||||
|| (FileSystem.stat(path).mtime.getTime() > FileSystem.stat(project.projectFilePath).mtime.getTime())))
|
||||
{
|
||||
return File.getContent(path);
|
||||
}
|
||||
|
||||
@@ -371,7 +371,12 @@ class TVOSPlatform extends PlatformTarget
|
||||
{
|
||||
var path = targetDirectory + "/" + project.app.file + "/haxe/Build.hxml";
|
||||
|
||||
if (FileSystem.exists(path))
|
||||
// try to use the existing .hxml file. however, if the project file was
|
||||
// modified more recently than the .hxml, then the .hxml cannot be
|
||||
// considered valid anymore. it may cause errors in editors like vscode.
|
||||
if (FileSystem.exists(path)
|
||||
&& (project.projectFilePath == null || !FileSystem.exists(project.projectFilePath)
|
||||
|| (FileSystem.stat(path).mtime.getTime() > FileSystem.stat(project.projectFilePath).mtime.getTime())))
|
||||
{
|
||||
return File.getContent(path);
|
||||
}
|
||||
|
||||
@@ -359,7 +359,12 @@ class WebAssemblyPlatform extends PlatformTarget
|
||||
{
|
||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||
|
||||
if (FileSystem.exists(path))
|
||||
// try to use the existing .hxml file. however, if the project file was
|
||||
// modified more recently than the .hxml, then the .hxml cannot be
|
||||
// considered valid anymore. it may cause errors in editors like vscode.
|
||||
if (FileSystem.exists(path)
|
||||
&& (project.projectFilePath == null || !FileSystem.exists(project.projectFilePath)
|
||||
|| (FileSystem.stat(path).mtime.getTime() > FileSystem.stat(project.projectFilePath).mtime.getTime())))
|
||||
{
|
||||
return File.getContent(path);
|
||||
}
|
||||
|
||||
@@ -593,7 +593,12 @@ class WindowsPlatform extends PlatformTarget
|
||||
{
|
||||
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||
|
||||
if (FileSystem.exists(path))
|
||||
// try to use the existing .hxml file. however, if the project file was
|
||||
// modified more recently than the .hxml, then the .hxml cannot be
|
||||
// considered valid anymore. it may cause errors in editors like vscode.
|
||||
if (FileSystem.exists(path)
|
||||
&& (project.projectFilePath == null || !FileSystem.exists(project.projectFilePath)
|
||||
|| (FileSystem.stat(path).mtime.getTime() > FileSystem.stat(project.projectFilePath).mtime.getTime())))
|
||||
{
|
||||
return File.getContent(path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user