Skip to content

Commit

Permalink
Revert "Smart semicolon autocorrect (#3159)"
Browse files Browse the repository at this point in the history
This reverts commit 3ad9b16.
  • Loading branch information
testforstephen authored and rgrunber committed Jul 27, 2023
1 parent f6aa821 commit 829e8c6
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 142 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

## 1.21.0 (July 27th, 2023)
* performance - Check completion proposal is compatible or not. See [JLS#2733](https://github.com/eclipse/eclipse.jdt.ls/pull/2733).
* enhancement - Add support for smart semicolon insertion. See [#703](https://github.com/redhat-developer/vscode-java/issues/703).
* enhancement - Add code actions for Join/Split variable. See [JLS#2732](https://github.com/eclipse/eclipse.jdt.ls/pull/2732).
* enhancement - Support outline view for decompiled source. See [JLS#2742](https://github.com/eclipse/eclipse.jdt.ls/pull/2742).
* enhancement - Reload the cached classfile sources when their source attachment is updated. See [#3207](https://github.com/redhat-developer/vscode-java/pull/3207).
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ New in 1.21.0
- `ask`: Ask to reload the sources of the open class files
- `auto`: Automatically reload the sources of the open class files
- `manual`: Manually reload the sources of the open class files
* `java.edit.smartSemicolonDetection.enabled`: Defines the `smart semicolon` detection. Defaults to `false`.

Semantic Highlighting
===============
Expand Down
26 changes: 0 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1140,12 +1140,6 @@
"markdownDescription": "Specifies whether to recheck all open Java files for diagnostics when editing a Java file.",
"scope": "window"
},
"java.edit.smartSemicolonDetection.enabled": {
"type": "boolean",
"default": false,
"markdownDescription": "Defines the `smart semicolon` detection. Defaults to `false`.",
"scope": "window"
},
"java.editor.reloadChangedSources": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -1308,16 +1302,6 @@
"command": "java.server.restart",
"title": "%java.server.restart%",
"category": "Java"
},
{
"command": "java.edit.smartSemicolonDetection.command",
"title": "%java.edit.smartSemicolonDetection%",
"category": "Java"
},
{
"command": "java.edit.smartSemicolonDetectionUndo",
"title": "%java.edit.smartSemicolonDetectionUndo%",
"category": "Java"
}
],
"keybindings": [
Expand All @@ -1335,16 +1319,6 @@
"key": "ctrl+shift+v",
"mac": "cmd+shift+v",
"when": "javaLSReady && editorLangId == java"
},
{
"command": "java.edit.smartSemicolonDetection.command",
"key": ";",
"when": "editorFocus && javaLSReady && editorLangId == java"
},
{
"command": "java.edit.smartSemicolonDetectionUndo",
"key": "backspace",
"when": "editorFocus && javaLSReady && editorLangId == java"
}
],
"menus": {
Expand Down
4 changes: 1 addition & 3 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,5 @@
"java.action.changeBaseType": "Base on this Type",
"java.project.createModuleInfo.command": "Create module-info.java",
"java.clean.sharedIndexes": "Clean Shared Indexes",
"java.server.restart": "Restart Java Language Server",
"java.edit.smartSemicolonDetection": "Java Smart Semicolon Detection",
"java.edit.smartSemicolonDetectionUndo": "Java Smart Semicolon Detection Undo"
"java.server.restart": "Restart Java Language Server"
}
11 changes: 0 additions & 11 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,4 @@ export namespace Commands {
*/
export const GET_DECOMPILED_SOURCE = "java.decompile";

/**
* Smart semicolon detection.
*/
export const SMARTSEMICOLON_DETECTION = "java.edit.smartSemicolonDetection";
export const SMARTSEMICOLON_DETECTION_CMD = "java.edit.smartSemicolonDetection.command";

/**
* Smart semicolon detection backspace.
*/
export const SMARTSEMICOLON_DETECTION_UNDO = "java.edit.smartSemicolonDetectionUndo";

}
3 changes: 2 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as fs from 'fs';
import * as fse from 'fs-extra';
import * as os from 'os';
import * as path from 'path';
import { CodeActionContext, commands, ConfigurationTarget, Diagnostic, env, EventEmitter, ExtensionContext, extensions, IndentAction, InputBoxOptions, languages, RelativePattern, TextDocument, UIKind, Uri, ViewColumn, window, workspace, WorkspaceConfiguration, ProgressLocation, Position, Selection, Range } from 'vscode';
import { CodeActionContext, commands, ConfigurationTarget, Diagnostic, env, EventEmitter, ExtensionContext, extensions, IndentAction, InputBoxOptions, languages, RelativePattern, TextDocument, UIKind, Uri, ViewColumn, window, workspace, WorkspaceConfiguration, ProgressLocation } from 'vscode';
import { CancellationToken, CodeActionParams, CodeActionRequest, Command, DidChangeConfigurationNotification, ExecuteCommandParams, ExecuteCommandRequest, LanguageClientOptions, RevealOutputChannelOn } from 'vscode-languageclient';
import { LanguageClient } from 'vscode-languageclient/node';
import { apiManager } from './apiManager';
Expand Down Expand Up @@ -268,6 +268,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
// the promise is resolved
// no need to pass `resolve` into any code past this point,
// since `resolve` is a no-op from now on

const serverOptions = prepareExecutable(requirements, syntaxServerWorkspacePath, getJavaConfig(requirements.java_home), context, true);
if (requireSyntaxServer) {
if (process.env['SYNTAXLS_CLIENT_PORT']) {
Expand Down
9 changes: 1 addition & 8 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import * as fs from 'fs';
import * as path from 'path';
import { commands, ConfigurationTarget, env, ExtensionContext, Position, Range, Selection, SnippetString, TextDocument, Uri, window, workspace, WorkspaceConfiguration, WorkspaceFolder } from 'vscode';
import { commands, ConfigurationTarget, env, ExtensionContext, Position, Range, SnippetString, TextDocument, Uri, window, workspace, WorkspaceConfiguration, WorkspaceFolder } from 'vscode';
import { Commands } from './commands';
import { cleanupLombokCache } from './lombokSupport';
import { ensureExists, getJavaConfiguration } from './utils';
import { apiManager } from './apiManager';
import { setSmartSemiColonDetectionState } from './smartSemicolonDetection';

const DEFAULT_HIDDEN_FILES: string[] = ['**/.classpath', '**/.project', '**/.settings', '**/.factorypath'];
const IS_WORKSPACE_JDK_ALLOWED = "java.ls.isJdkAllowed";
Expand Down Expand Up @@ -331,9 +329,6 @@ export function handleTextBlockClosing(document: TextDocument, changes: readonly
return;
}
if (lastChange.text !== '"""";') {
if (lastChange.text !== ';') {
setSmartSemiColonDetectionState(null, null);
}
return;
}
const selection = activeTextEditor.selection.active;
Expand All @@ -354,5 +349,3 @@ export function handleTextBlockClosing(document: TextDocument, changes: readonly
}
}
}


76 changes: 0 additions & 76 deletions src/smartSemicolonDetection.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/standardLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { getAllJavaProjects, getJavaConfig, getJavaConfiguration } from "./utils
import { Telemetry } from "./telemetry";
import { TelemetryEvent } from "@redhat-developer/vscode-redhat-telemetry/lib";
import { registerDocumentValidationListener } from './diagnostic';
import { registerSmartSemicolonDetection } from './smartSemicolonDetection';

const extensionName = 'Language Support for Java';
const GRADLE_CHECKSUM = "gradle/checksum/prompt";
Expand Down Expand Up @@ -138,11 +137,6 @@ export class StandardLanguageClient {
// clients may not have properly configured documentPaste
logger.error(error);
}
try {
registerSmartSemicolonDetection(context);
} catch (error) {
logger.error(error);
}
activationProgressNotification.hide();
if (!hasImported) {
showImportFinishNotification(context);
Expand Down
9 changes: 0 additions & 9 deletions test/standard-mode-suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ suite('Java Language Extension - Standard', () => {
return vscode.commands.getCommands(true).then((commands) =>
{
const JAVA_COMMANDS = [
Commands.ADD_TO_SOURCEPATH,
Commands.ADD_TO_SOURCEPATH_CMD,
Commands.APPLY_REFACTORING_COMMAND,
Commands.APPLY_WORKSPACE_EDIT,
Expand All @@ -54,7 +53,6 @@ suite('Java Language Extension - Standard', () => {
Commands.CLIPBOARD_ONPASTE,
Commands.COMPILE_WORKSPACE,
Commands.CONFIGURATION_UPDATE,
Commands.CREATE_MODULE_INFO,
Commands.CREATE_MODULE_INFO_COMMAND,
Commands.EXECUTE_WORKSPACE_COMMAND,
Commands.GENERATE_ACCESSORS_PROMPT,
Expand Down Expand Up @@ -104,20 +102,13 @@ suite('Java Language Extension - Standard', () => {
Commands.SHOW_SERVER_TASK_STATUS,
Commands.SWITCH_SERVER_MODE,
"java.edit.stringFormatting",
"java.completion.onDidSelect",
"java.decompile",
"java.protobuf.generateSources",
Commands.SHOW_TYPE_HIERARCHY,
Commands.SHOW_SUBTYPE_HIERARCHY,
Commands.SHOW_SUPERTYPE_HIERARCHY,
Commands.SHOW_CLASS_HIERARCHY,
Commands.UPGRADE_GRADLE_WRAPPER,
Commands.UPGRADE_GRADLE_WRAPPER_CMD,
Commands.UPDATE_SOURCE_ATTACHMENT,
Commands.UPDATE_SOURCE_ATTACHMENT_CMD,
Commands.SMARTSEMICOLON_DETECTION_CMD,
Commands.SMARTSEMICOLON_DETECTION_UNDO,
Commands.RESOLVE_SOURCE_ATTACHMENT,
].sort();
const foundJavaCommands = commands.filter((value) => {
return JAVA_COMMANDS.indexOf(value)>=0 || value.startsWith('java.');
Expand Down

0 comments on commit 829e8c6

Please sign in to comment.