Skip to content

Commit 53d89a5

Browse files
author
Tobias Bordenca
committed
Fix style issues
1 parent 15ffcc8 commit 53d89a5

File tree

3 files changed

+79
-80
lines changed

3 files changed

+79
-80
lines changed

vscode-dotty/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ function run(serverOptions: ServerOptions, isOldServer: boolean) {
339339

340340
const providerRegistration = Disposable.from(
341341
vscode.workspace.registerTextDocumentContentProvider(DecompiledDocumentProvider.scheme, provider)
342-
);
342+
)
343343

344344
extensionContext.subscriptions.push(providerRegistration, provider)
345345

vscode-dotty/src/features.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export interface TastyDecompilerClientCapabilities {
7878
}
7979

8080
export class TastyDecompilerFeature extends TextDocumentFeature<TextDocumentRegistrationOptions> {
81-
constructor(client: BaseLanguageClient, readonly provider: DecompiledDocumentProvider) {
82-
super(client, TastyDecompileRequest.type);
81+
constructor(client: BaseLanguageClient, readonly provider: DecompiledDocumentProvider) {
82+
super(client, TastyDecompileRequest.type)
8383
}
8484

8585
fillClientCapabilities(capabilities: ClientCapabilities & TastyDecompilerClientCapabilities): void {

vscode-dotty/src/tasty-decompiler.ts

Lines changed: 76 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,33 @@ export class TastyDecompilerProvider implements Disposable {
1919
readonly documentSelector: vscode.DocumentSelector,
2020
readonly provider: DecompiledDocumentProvider) {
2121
this.disposables.push(
22-
vscode.workspace.onDidOpenTextDocument( textDocument => {
22+
vscode.workspace.onDidOpenTextDocument(textDocument => {
2323
if (this.isTasty(textDocument)) {
24-
this.requestDecompile(textDocument).then( decompileResult => {
25-
switch(decompileResult.error) {
24+
this.requestDecompile(textDocument).then(decompileResult => {
25+
switch (decompileResult.error) {
2626
case RESULT_OK:
2727
let scalaDocument = provider.makeScalaDocument(textDocument, decompileResult.scala)
2828

2929
vscode.workspace.openTextDocument(scalaDocument).then(doc => {
3030
vscode.window.showTextDocument(doc, 1)
31-
});
31+
})
3232

3333
let fileName = textDocument.fileName.substring(textDocument.fileName.lastIndexOf(path.sep) + 1)
3434

3535
TastyTreeView.create(fileName, decompileResult.tastyTree)
36-
break;
36+
break
3737
case ERROR_TASTY_VERSION:
3838
vscode.window.showErrorMessage("Tasty file has unexpected signature.")
39-
break;
39+
break
4040
case ERROR_CLASS_NOT_FOUND:
4141
vscode.window.showErrorMessage("The class file related to this TASTy file could not be found.")
42-
break;
42+
break
4343
case ERROR_OTHER:
4444
vscode.window.showErrorMessage("A decompilation error has occurred.")
45-
break;
45+
break
4646
default:
4747
vscode.window.showErrorMessage("Unknown Error.")
48-
break;
48+
break
4949
}
5050
})
5151
}
@@ -54,8 +54,8 @@ export class TastyDecompilerProvider implements Disposable {
5454
}
5555

5656
dispose(): void {
57-
this.disposables.forEach(d => d.dispose())
58-
this.disposables = []
57+
this.disposables.forEach(d => d.dispose())
58+
this.disposables = []
5959
}
6060

6161
/**
@@ -72,44 +72,43 @@ export class TastyDecompilerProvider implements Disposable {
7272
title: "Decompiling"
7373
}, () => this.client.sendRequest(TastyDecompileRequest.type, requestParams, token)
7474
))
75-
}).then( decompileResult => {
76-
canceller.dispose()
77-
return decompileResult
78-
});
75+
}).then(decompileResult => {
76+
canceller.dispose()
77+
return decompileResult
78+
})
7979
}
8080

81-
/** Is this document a tasty file? */
82-
private isTasty(document: vscode.TextDocument): boolean {
83-
return vscode.languages.match(this.documentSelector, document) > 0
84-
}
85-
81+
/** Is this document a tasty file? */
82+
private isTasty(document: vscode.TextDocument): boolean {
83+
return vscode.languages.match(this.documentSelector, document) > 0
84+
}
8685
}
8786

8887
/**
8988
* Provider of virtual, read-only, scala documents
9089
*/
9190
export class DecompiledDocumentProvider implements vscode.TextDocumentContentProvider {
92-
static scheme = 'decompiled';
91+
static scheme = 'decompiled'
9392

94-
private _documents = new Map<string, string>();
95-
private _subscriptions: vscode.Disposable;
93+
private _documents = new Map<string, string>()
94+
private _subscriptions: vscode.Disposable
9695

9796
constructor() {
9897
// Don't keep closed documents in memory
99-
this._subscriptions = vscode.workspace.onDidCloseTextDocument(doc => this._documents.delete(doc.uri.toString()));
98+
this._subscriptions = vscode.workspace.onDidCloseTextDocument(doc => this._documents.delete(doc.uri.toString()))
10099
}
101100

102101
dispose() {
103-
this._subscriptions.dispose();
104-
this._documents.clear();
102+
this._subscriptions.dispose()
103+
this._documents.clear()
105104
}
106105

107-
provideTextDocumentContent(uri: vscode.Uri): string {
108-
let document = this._documents.get(uri.toString());
109-
if (document) {
110-
return document;
106+
provideTextDocumentContent(uri: vscode.Uri): string {
107+
let document = this._documents.get(uri.toString())
108+
if (document) {
109+
return document
111110
} else {
112-
return 'Failed to load result.';
111+
return 'Failed to load result.'
113112
}
114113
}
115114

@@ -119,70 +118,70 @@ export class DecompiledDocumentProvider implements vscode.TextDocumentContentPro
119118
* @param textDocument The document containing the TASTy that was decompiled
120119
* @param content The source code provided by the language server
121120
*/
122-
makeScalaDocument(textDocument: vscode.TextDocument, content: string): vscode.Uri {
121+
makeScalaDocument(textDocument: vscode.TextDocument, content: string): vscode.Uri {
123122
let scalaDocument = textDocument.uri.with({
124123
scheme: DecompiledDocumentProvider.scheme,
125-
path: textDocument.uri.path.replace(".tasty", ".scala")
124+
path: textDocument.uri.path.replace(".tasty", ".scala")
126125
})
127-
this._documents.set(scalaDocument.toString(), content);
128-
return scalaDocument;
126+
this._documents.set(scalaDocument.toString(), content)
127+
return scalaDocument
129128
}
130129
}
131130

132131
/**
133132
* WebView used as container for preformatted TASTy trees
134133
*/
135134
class TastyTreeView {
136-
public static readonly viewType = 'tastyTree';
135+
public static readonly viewType = 'tastyTree'
137136

138-
private readonly _panel: vscode.WebviewPanel;
139-
private _disposables: vscode.Disposable[] = [];
137+
private readonly _panel: vscode.WebviewPanel
138+
private _disposables: vscode.Disposable[] = []
140139

141-
/**
142-
* Create new panel for a TASTy tree in a new column or column 2 if none is currently open
143-
*
144-
* @param title The panel's title
145-
* @param content The panel's preformatted content
146-
*/
147-
public static create(title: string, content: string) {
148-
const column = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn : undefined;
140+
/**
141+
* Create new panel for a TASTy tree in a new column or column 2 if none is currently open
142+
*
143+
* @param title The panel's title
144+
* @param content The panel's preformatted content
145+
*/
146+
public static create(title: string, content: string) {
147+
const column = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn : undefined
149148

150-
const panel = vscode.window.createWebviewPanel(TastyTreeView.viewType, "Tasty Tree", (column || vscode.ViewColumn.One) + 1, {});
149+
const panel = vscode.window.createWebviewPanel(TastyTreeView.viewType, "Tasty Tree", (column || vscode.ViewColumn.One) + 1, {})
151150

152-
new TastyTreeView(panel, title, content);
153-
}
151+
new TastyTreeView(panel, title, content)
152+
}
154153

155-
private constructor(
156-
panel: vscode.WebviewPanel,
157-
title: string,
158-
content: string
159-
) {
160-
this._panel = panel;
161-
this.setContent(title, content)
162-
163-
// Listen for when the panel is disposed
164-
// This happens when the user closes the panel or when the panel is closed programmatically
165-
this._panel.onDidDispose(() => this.dispose(), null, this._disposables);
166-
}
154+
private constructor(
155+
panel: vscode.WebviewPanel,
156+
title: string,
157+
content: string
158+
) {
159+
this._panel = panel
160+
this.setContent(title, content)
161+
162+
// Listen for when the panel is disposed
163+
// This happens when the user closes the panel or when the panel is closed programmatically
164+
this._panel.onDidDispose(() => this.dispose(), null, this._disposables)
165+
}
167166

168-
public dispose() {
169-
this._panel.dispose();
167+
public dispose() {
168+
this._panel.dispose()
170169

171-
while (this._disposables.length) {
172-
const x = this._disposables.pop();
173-
if (x) {
174-
x.dispose();
175-
}
176-
}
170+
while (this._disposables.length) {
171+
const x = this._disposables.pop()
172+
if (x) {
173+
x.dispose()
174+
}
177175
}
176+
}
178177

179-
private setContent(name: string, content: string) {
180-
this._panel.title = name;
181-
this._panel.webview.html = this._getHtmlForWebview(content);
182-
}
178+
private setContent(name: string, content: string) {
179+
this._panel.title = name
180+
this._panel.webview.html = this._getHtmlForWebview(content)
181+
}
183182

184-
private _getHtmlForWebview(content: string) {
185-
return `<!DOCTYPE html>
183+
private _getHtmlForWebview(content: string) {
184+
return `<!DOCTYPE html>
186185
<html lang="en">
187186
<head>
188187
<style>
@@ -207,6 +206,6 @@ class TastyTreeView {
207206
<pre>
208207
${content}</pre>
209208
</body>
210-
</html>`;
211-
}
209+
</html>`
210+
}
212211
}

0 commit comments

Comments
 (0)