Giter Club home page Giter Club logo

Comments (5)

rgrunber avatar rgrunber commented on June 3, 2024

Once a selection is made, the option is stored in the workspace state database :

} else if (activeBuildTool.toLocaleLowerCase().includes("maven")) {
// Here we do not persist it in the settings to avoid generating/updating files in user's workspace
// Later if user want to change the active build tool, just directly set the related settings.
clientOptions.initializationOptions.settings.java.import.gradle.enabled = false;
context.workspaceState.update(ACTIVE_BUILD_TOOL_STATE, "maven");
} else if (activeBuildTool.toLocaleLowerCase().includes("gradle")) {
clientOptions.initializationOptions.settings.java.import.maven.enabled = false;
context.workspaceState.update(ACTIVE_BUILD_TOOL_STATE, "gradle");
, so we could probably restore the option to choose by resetting the value in
export function cleanupProjectPickerCache(context: ExtensionContext) {
context.workspaceState.update(PICKED_BUILD_FILES, undefined);
context.workspaceState.update(BUILD_TOOL_FOR_CONFLICTS, undefined);
context.workspaceState.update(IMPORT_METHOD, undefined);
}
(and probably rename the method) , which gets triggered by "Clean Workspace Cache" (quick-pick from server status bar) or "Java: Clean Java Language Server Workspace" (command palette).

With that said, can you try what's mentioned in that comment, and just set :

{
"java.import.gradle.enabled": "...",
"java.import.maven.enabled": "..."
}

in your workspace (.vscode/settings.json) settings file ?

as a workaround ?

Update: Also, yes, if https://github.com/moderneinc/rewrite-recipe-starter is the project, then I'm seeing the same error. @snjeza any idea why ?

from vscode-java.

FieteO avatar FieteO commented on June 3, 2024

Okay, generally changing the build tool works when setting either one of the

"java.import.gradle.enabled": false,
"java.import.maven.enabled": true

settings to true or false and then do a Java: Clean Language Server Workspace. Just reloading the window for instance is not enough to change it.

In terms of making this more accessible, maybe the Type in Java: Configure Runtimes could be made editable similar to how the Java version can be changed there:
image

from vscode-java.

rgrunber avatar rgrunber commented on June 3, 2024

I guess https://github.com/microsoft/vscode-java-pack/blob/main/src/java-runtime/index.ts could be updated to modify the active build tool for the particular workspace. @testforstephen , thoughts on this improvement ?

from vscode-java.

testforstephen avatar testforstephen commented on June 3, 2024

Pls note that Configure Runtime for Projects page is purely nodejs UI thing, no any Java logic. If we want to open the ability to reimport the workspace with different build tool there, this definitely requires language server to provide the command to do that.

Anyway, I think when you clean the language server workspace, Java extension should prompt and ask you to select the build tool again before importing mixed build tool workspace. If this is not the behavior, then it's a bug in vscode-java extension.

from vscode-java.

rgrunber avatar rgrunber commented on June 3, 2024

Java: Clean Language Server Workspace should clear the saved build tool selection now.

from vscode-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.