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

Hide java project setting files by default. #776

Merged
merged 5 commits into from
Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change Log

## 0.38.0 (January 30th, 2019)
## 0.38.0 (January 31st, 2019)
* enhancement - new dialog asking to hide java project settings files on startup. See [#776](https://github.com/redhat-developer/vscode-java/pull/776).
* bug fix - pick up gradle properties updates when doing full build. See [#758](https://github.com/redhat-developer/vscode-java/issues/758).
* bug fix - fixed inactive autocompletion after inserting a snippet in some cases. See [#768](https://github.com/redhat-developer/vscode-java/issues/768).

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The following settings are supported:
* `java.import.gradle.enabled` : Enable/disable the Gradle importer.
* `java.import.maven.enabled` : Enable/disable the Maven importer.
* `java.autobuild.enabled` : Enable/disable the 'auto build'.
* `java.maxConcurrentBuilds`: Set max simultaneous project builds.
* `java.completion.favoriteStaticMembers` : Defines a list of static members or types with static members.
* `java.completion.importOrder` : Defines the sorting order of import statements.
* `java.progressReports.enabled` : [Experimental] Enable/disable progress reports from background processes on the server.
Expand All @@ -91,8 +92,8 @@ The following settings are supported:
* `java.completion.guessMethodArguments` : When set to true, method arguments are guessed when a method is selected from as list of code assist proposals.
* `java.completion.enabled` : Enable/disable code completion support.

*New in 0.36.0:*
* `java.maxConcurrentBuilds`: Set max simultaneous project builds.
*New in 0.38.0:*
* `java.configuration.checkProjectSettingsExclusions`: Checks if the extension-generated project settings files (`.project`, `.classpath`, `.factorypath`, `.settings/`) should be excluded from the file explorer. Defaults to `true`.


Troubleshooting
Expand Down
54 changes: 34 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
"description": "Specifies the severity of the message when the classpath is incomplete for a Java file",
"scope": "window"
},
"java.configuration.checkProjectSettingsExclusions": {
"type": "boolean",
"default": true,
"description": "Checks if the extension-generated project settings files (.project, .classpath, .factorypath, .settings/) should be excluded from the file explorer.",
"scope": "window"
},
"java.configuration.updateBuildConfiguration": {
"type": [
"string"
Expand Down
38 changes: 4 additions & 34 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ SourceAttachmentRequest, SourceAttachmentResult, SourceAttachmentAttribute } fro
import { ExtensionAPI } from './extension.api';
import * as buildpath from './buildpath';
import * as net from 'net';
import { getJavaConfiguration } from './utils';
import { onConfigurationChange, excludeProjectSettingsFiles } from './settings';

let oldConfig;
let lastStatus;
let languageClient: LanguageClient;
let jdtEventEmitter = new EventEmitter<Uri>();
Expand Down Expand Up @@ -83,7 +84,6 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
item.command = Commands.OPEN_OUTPUT;
let progressBar = window.createStatusBarItem(StatusBarAlignment.Left, Number.MIN_VALUE+1);

oldConfig = getJavaConfiguration();
let serverOptions;
let port = process.env['SERVER_PORT'];
if (!port) {
Expand Down Expand Up @@ -300,6 +300,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
}
};
workspace.registerTextDocumentContentProvider('jdt', provider);
excludeProjectSettingsFiles();
});

let cleanWorkspaceExists = fs.existsSync( path.join(workspacePath, cleanWorkspaceFileName));
Expand Down Expand Up @@ -434,34 +435,6 @@ function isJavaConfigFile(path: String) {
return path.endsWith('pom.xml') || path.endsWith('.gradle');
}

function onConfigurationChange() {
return workspace.onDidChangeConfiguration(params => {
let newConfig = getJavaConfiguration();
if (hasJavaConfigChanged(oldConfig, newConfig)) {
let msg = 'Java Language Server configuration changed, please restart VS Code.';
let action = 'Restart Now';
let restartId = Commands.RELOAD_WINDOW;
oldConfig = newConfig;
window.showWarningMessage(msg, action).then((selection) => {
if (action === selection) {
commands.executeCommand(restartId);
}
});
}
});
}

function hasJavaConfigChanged(oldConfig, newConfig) {
return hasConfigKeyChanged('home', oldConfig, newConfig)
|| hasConfigKeyChanged('jdt.ls.vmargs', oldConfig, newConfig)
|| hasConfigKeyChanged('progressReports.enabled', oldConfig, newConfig);
}

function hasConfigKeyChanged(key, oldConfig, newConfig) {
return oldConfig.get(key) !== newConfig.get(key);
}


function getTempWorkspace() {
return path.resolve(os.tmpdir(), 'vscodesws_' + makeRandomHexString(5));
}
Expand All @@ -476,9 +449,6 @@ function makeRandomHexString(length) {
return result;
}

function getJavaConfiguration(): WorkspaceConfiguration {
return workspace.getConfiguration('java');
}

async function cleanWorkspace(workspacePath) {
const doIt = 'Restart and delete';
Expand Down Expand Up @@ -745,4 +715,4 @@ function isPrefix(parentPath: string, childPath: string): boolean {
}
const relative = path.relative(parentPath, childPath);
return !!relative && !relative.startsWith('..') && !path.isAbsolute(relative);
}
}
Loading