Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Commit 725bde8

Browse files
committed
Reduce dependencies: remove show ppx and the dep on Reason_toolchain.
1 parent 670cce5 commit 725bde8

File tree

4 files changed

+1
-97
lines changed

4 files changed

+1
-97
lines changed

editor-extensions/vscode/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@
2929
"command": "reason-language-server.restart",
3030
"title": "Restart Reason Language Server"
3131
},
32-
{
33-
"command": "reason-language-server.show_ppxed_source",
34-
"title": "Reason: Show the fully ppxed source for this file."
35-
},
3632
{
3733
"command": "reason-language-server.show_ast",
3834
"title": "Reason: Show the abstract syntax tree (AST) for this file."

editor-extensions/vscode/src/index.js

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -221,60 +221,19 @@ function activate(context) {
221221
}
222222
}
223223

224-
class PpxedSourceProvider {
225-
constructor() {
226-
this.privateOnDidChange = new vscode.EventEmitter()
227-
this.onDidChange = this.privateOnDidChange.event;
228-
}
229-
provideTextDocumentContent(uri, token) {
230-
if (!client) {
231-
return Promise.reject("No language client running")
232-
}
233-
234-
return client.sendRequest("custom:reasonLanguageServer/showPpxedSource", {
235-
"textDocument": {
236-
"uri": uri.with({scheme: 'file'}).toString(),
237-
},
238-
// unused currently
239-
"position": {character: 0, line: 0},
240-
})
241-
}
242-
}
243-
244-
const provider = new PpxedSourceProvider()
245224
const astProvider = new AstSourceProvider()
246225

247226
context.subscriptions.push(
248227
vscode.workspace.onDidSaveTextDocument((document) => {
249228
const uri = document.uri;
250-
provider.privateOnDidChange.fire(uri.with({scheme: 'ppxed-source'}))
251229
astProvider.privateOnDidChange.fire(uri.with({scheme: 'ast-source'}))
252230
}),
253231
);
254232

255233
context.subscriptions.push(configureLanguage());
256234

257-
vscode.workspace.registerTextDocumentContentProvider("ppxed-source", provider);
258235
vscode.workspace.registerTextDocumentContentProvider("ast-source", astProvider);
259236

260-
const showPpxedSource = () => {
261-
if (!client) {
262-
return vscode.window.showInformationMessage('Language server not running');
263-
}
264-
const editor = vscode.window.activeTextEditor;
265-
if (!editor) {
266-
return vscode.window.showInformationMessage('No active editor');
267-
}
268-
if (editor.document.languageId !== 'ocaml' && editor.document.languageId !== 'reason') {
269-
return vscode.window.showInformationMessage('Not an OCaml or Reason file');
270-
}
271-
272-
const document = TextDocument.create(editor.document.uri.with({scheme: 'ppxed-source'}), editor.document.languageId, 1, '');
273-
vscode.window.showTextDocument(document);
274-
};
275-
276-
vscode.commands.registerCommand('reason-language-server.show_ppxed_source', showPpxedSource);
277-
278237
vscode.commands.registerCommand('reason-language-server.dump_file_data', () => {
279238
if (!client) {
280239
return vscode.window.showInformationMessage('Language server not running');

src/rescript-editor-support/MessageHandlers.re

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -749,57 +749,6 @@ let handlers:
749749
Ok((state, Json.Null));
750750
},
751751
),
752-
(
753-
"custom:reasonLanguageServer/showPpxedSource",
754-
(state, params) => {
755-
let%try (uri, _pos) = Protocol.rPositionParams(params);
756-
let%try package = getPackage(uri, state);
757-
let%try (file, _extra) = State.fileForUri(state, ~package, uri);
758-
let%try parsetree =
759-
AsYouType.getParsetree(
760-
~uri,
761-
~moduleName=file.moduleName,
762-
~cacheLocation=package.tmpPath,
763-
);
764-
if (State.isMl(uri)) {
765-
switch (parsetree) {
766-
| `Implementation(str) =>
767-
Pprintast.structure(Format.str_formatter, str)
768-
| `Interface(int) => Pprintast.signature(Format.str_formatter, int)
769-
};
770-
} else {
771-
module Convert =
772-
Migrate_parsetree.Convert(
773-
Migrate_parsetree.OCaml_406,
774-
Migrate_parsetree.OCaml_408,
775-
);
776-
switch (parsetree) {
777-
| `Implementation(str) =>
778-
Reason_toolchain.RE.print_implementation_with_comments(
779-
Format.str_formatter,
780-
(Convert.copy_structure(str), []),
781-
)
782-
| `Interface(int) =>
783-
Reason_toolchain.RE.print_interface_with_comments(
784-
Format.str_formatter,
785-
(Convert.copy_signature(int), []),
786-
)
787-
};
788-
};
789-
let source = Format.flush_str_formatter();
790-
791-
/* let source = State.isMl(uri) ? source : switch (package.refmtPath) {
792-
| None => source
793-
| Some(refmt) =>
794-
let interface = Utils.endsWith(uri, "i");
795-
switch (AsYouType.convertToRe(~formatWidth=None, ~interface, source, refmt)) {
796-
| RResult.Error(_) => source
797-
| Ok(s) => s
798-
}
799-
}; */
800-
Ok((state, Json.String(source)));
801-
},
802-
),
803752
(
804753
"custom:reasonLanguageServer/showAst",
805754
(state, params) => {

src/rescript-editor-support/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(executable
33
(name RescriptEditorSupport)
44
(public_name rescript-editor-support.exe)
5-
(libraries str reason ocaml-migrate-parsetree uri bigarray)
5+
(libraries str ocaml-migrate-parsetree uri bigarray)
66
(flags "-w" "+26+27+32+33+39")
77
(preprocess (pps Ppx_monads))
88
)

0 commit comments

Comments
 (0)