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

Auto-discovered HXML takes higher priority than settings.json #295

Closed
jgranick opened this issue Sep 12, 2018 · 6 comments
Closed

Auto-discovered HXML takes higher priority than settings.json #295

jgranick opened this issue Sep 12, 2018 · 6 comments

Comments

@jgranick
Copy link

In OpenFL, VSHaxe finds two "auto-discovered" HXML files for completion, but OpenFL also includes a settings.json to specify exactly the completion parameters that should be used when updating the library.

The workspace (as I understand) does remember which option you select, but initially, it appears to select one of the auto-discovered files first (perhaps alphabetically?)

I think completion defined in the workspace settings.json should take higher priority by default. Thank you 😄

@Gama11
Copy link
Member

Gama11 commented Sep 13, 2018

Hm.. I remember this being an issue, but I can't reproduce it anymore - when I open a freshly cloned OpenFL repo, scripts/completion.hxml is selected by default. The same is true for this simple test workspace: test.zip

Do you see different results?

@jgranick
Copy link
Author

I recently re-installed Visual Studio Code, and this occurred, but perhaps (?) it's possible that it defaults differently, and this machine had residual settings to save the default as being the wrong choice.

Is there code in the plugin that decides which to favor?

@Gama11
Copy link
Member

Gama11 commented Sep 13, 2018

Not explicitly, but the default configuration index is 0:

var selection = context.getWorkspaceState().get(ConfigurationIndexKey, 0);

And the list of configurations is constructed in such a way that configured ones come first, then discovered ones:

configurations = [];
for (i in 0...configs.length) {
var config = configs[i];
var args = null;
var label = null;
if (Std.is(config, Array)) {
args = config;
} else {
var config:ComplexSettingsConfiguration = cast config;
args = config.args;
label = config.label;
}
configurations.push({kind: Configured(i, label), args: args});
}
for (hxmlFile in hxmlDiscovery.files) {
var hxmlConfig = [hxmlFile];
if (!configs.exists(config -> config.equals(hxmlConfig))) {
configurations.push({kind: Discovered(hxmlFile), args: hxmlConfig});
}
}
}

@jgranick
Copy link
Author

Okay, so perhaps this was saved somewhere. I'll comment again if this seems not to be the case, but there's a high likelihood that I did use VSCode to open the OpenFL directory before, and this workspace setting might have been saved already.

Although, now that I think about it, one other question -- If a user opens a project with only auto-discovered options, and does not choose it themselves, will it save the auto-selected setting, or will it remain unsaved until they change it themselves? Might be good not to save a setting if they don't make one themselves, so if the default improves over time for a library, they benefit immediately

@Gama11
Copy link
Member

Gama11 commented Sep 13, 2018

That should already be the case, nothing is saved unless the user explicitly selects something in the UI.

@Gama11
Copy link
Member

Gama11 commented Sep 13, 2018

Hm, actually, the code doesn't seem to be making that distinction... I might be thinking of completion providers.

@Gama11 Gama11 reopened this Sep 13, 2018
@Gama11 Gama11 closed this as completed in c8747b3 Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants