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

Try to move import enhancement to server for better performance #181

Merged
merged 20 commits into from
Sep 6, 2020
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 .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"name": "Attach to Server",
"port": 9523,
"restart": true,
"outFiles": ["${workspaceRoot}/server/out/**/*.js"]
"outFiles": ["${workspaceRoot}/server/out/**/*.js"],
"sourceMaps": true
},
{
"name": "Language Server E2E Test",
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Features:

</details>

<details><summary>Intelligent module import enhanced</summary>

![Import enhanced](screenshot/import_enhancement.gif)

</details>

<details><summary>Supports importing ECMAScript modules</summary>

![Import](screenshot/ecma.gif)
Expand Down
35 changes: 0 additions & 35 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ import execa from "execa";
import * as semver from "semver";

import { TreeViewProvider } from "./tree_view_provider";
import {
ImportEnhancementCompletionProvider,
CACHE_STATE,
} from "./import_enhancement_provider";

import { ImportMap } from "../../core/import_map";
import { HashMeta } from "../../core/hash_meta";
import { isInDeno } from "../../core/deno";
Expand Down Expand Up @@ -118,9 +113,6 @@ export class Extension {
},
executablePath: "",
};
// CGQAQ: ImportEnhancementCompletionProvider instance
private import_enhancement_completion_provider = new ImportEnhancementCompletionProvider();

// get configuration of Deno
public getConfiguration(uri?: Uri): ConfigurationField {
const config: ConfigurationField = {};
Expand Down Expand Up @@ -473,14 +465,6 @@ Executable ${this.denoInfo.executablePath}`;
await window.showInformationMessage(`Copied to clipboard.`);
});

// CGQAQ: deno._clear_import_enhencement_cache
this.registerCommand("_clear_import_enhencement_cache", async () => {
this.import_enhancement_completion_provider
.clearCache()
.then(() => window.showInformationMessage("Clear success!"))
.catch(() => window.showErrorMessage("Clear failed!"));
});

this.registerQuickFix({
_fetch_remote_module: async (editor, text) => {
const config = this.getConfiguration(editor.document.uri);
Expand Down Expand Up @@ -611,23 +595,6 @@ Executable ${this.denoInfo.executablePath}`;
window.registerTreeDataProvider("deno", treeView)
);

// CGQAQ: activate import enhance feature
this.import_enhancement_completion_provider.activate(this.context);

// CGQAQ: Start caching full module list
this.import_enhancement_completion_provider
.cacheModList()
.then((state) => {
if (state === CACHE_STATE.CACHE_SUCCESS) {
window.showInformationMessage(
"deno.land/x module list cached successfully!"
);
}
})
.catch(() =>
window.showErrorMessage("deno.land/x module list failed to cache!")
);

this.sync(window.activeTextEditor?.document);

const extension = extensions.getExtension(this.id);
Expand All @@ -640,8 +607,6 @@ Executable ${this.denoInfo.executablePath}`;
public async deactivate(context: ExtensionContext): Promise<void> {
this.context = context;

this.import_enhancement_completion_provider.dispose();

if (this.client) {
await this.client.stop();
this.client = undefined;
Expand Down
255 changes: 0 additions & 255 deletions client/src/import_enhancement_provider.ts

This file was deleted.

27 changes: 0 additions & 27 deletions client/src/types/vscode-cache.d.ts

This file was deleted.

Loading