Commit Graph

436 Commits

Author SHA1 Message Date
bors[bot]
360890fcec
Merge #3053
3053: Feature: downloading lsp server from GitHub r=matklad a=Veetaha

This is currently very WIP, I may need to change this and that, add "download language server command", logging stuff (for future bug reports), etc., but it already works.
Also didn't test this on windows yet and mac (don't have the latter)

The quirks:
* Downloaded binary doesn't have executable permissions by default, that's why we ~~`chmod 111`~~ (**[UPD]** `chmod 755` as per @lnicola [suggestion](https://github.com/rust-analyzer/rust-analyzer/pull/3053#discussion_r376694456)) for it.
* To remove installed binary run `rm /${HOME}/.config/Code/User/globalStorage/matklad.rust-analyzer/ra_lsp_server-linux`, ~~note that `-f` flag is necessary, because of `111` permissions (I think this should be changed)~~ (**[UPD]** --force is no longer needed due to 755 permissions).

I also tried to keep things simple and not to use too many dependencies, all the ones added have 0 dependencies, (`ts-not-nil` is my personal npm package, that imitates `unwrap()` in TypeScript)

**[UPD]** I reduced throttle latency of progress indicator to 200ms for smoother UX


// TODO:
- [x] ~~Add `Rust Analyzer: Download latest language server` vscode command.~~ **[UPD]**: having reviewed the code and estimated available options I concluded that this feature requires too many code changes, I'd like to extract this into a separate PR after we merge this one.
- [x] Add some logging for future debugging
- [x] ~~Gracefully handle the case when language server is not available (e.g. no internet connection, user explicitly rejected the download, etc.)~~ **[UPD]** Decided to postpone better implementation of graceful degradation logic as per [conversation](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Deployment.20and.20installation/near/187758550).

Demo (**[UPD]** this is a bit outdated, but still mainly reflects the feature):
![ra-github-release-download-mvp](https://user-images.githubusercontent.com/36276403/74077961-4f248a80-4a2d-11ea-962f-27c650fd6c4c.gif)

Related issue: #2988 #3007 

Co-authored-by: Veetaha <gerzoh1@gmail.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-02-09 15:21:12 +00:00
Veetaha
7cba77ed4e vscode: added logging when donloading binaries 2020-02-09 15:01:00 +02:00
Veetaha
f3240e22c6 vscode: move throtting of download progress to call site 2020-02-09 14:18:05 +02:00
Veetaha
a63659badb vscode: replaced unwrapNotNil() with ! as per @matklad 2020-02-09 13:59:27 +02:00
Veetaha
7a09274e52 vscode: refactor inverted ternaries to if statements as per @matklad 2020-02-09 13:45:06 +02:00
Veetaha
34241b9af9 vscode: remove noise data fields declarations as per @matklad 2020-02-09 13:39:54 +02:00
Veetaha
3159e87c49 vscode: refactor levels of code nesting and string literals quotes 2020-02-09 13:36:36 +02:00
Veetaha
a3e3fba7bf
vscode: fix chmod to octal literal
Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-09 12:54:51 +02:00
Veetaha
d08ae7e82f vscode: minor names and message contents changes 2020-02-09 00:58:53 +02:00
Veetaha
fd6a98ef6e vscode: rename raLspServer variable to langServer 2020-02-09 00:42:51 +02:00
Veetaha
8f291c0089 vscode: refactor comment 2020-02-09 00:28:32 +02:00
Veetaha
539daf4454 vscode: refactor platform artifact name query to switch statement, move BinarySource union variants into a namespace 2020-02-09 00:27:04 +02:00
Veetaha
bdd88c2fad vscode: reduce throttle latency of downloadFile() progress callback for smoother UX 2020-02-08 21:25:03 +02:00
Veetaha
9791b6a8de vscode: add name to the second unused argument of withProgress() callback 2020-02-08 21:24:29 +02:00
Veetaha
4e85254444 vscode: add docs to installation module interfaces and sanity check to donloadFile() 2020-02-08 21:03:27 +02:00
Veetaha
6ef912f925 vscode: converted fetchLatestArtifactMetadata params to positional, added docs 2020-02-08 20:18:33 +02:00
Veetaha
f7ef72db64 vscode: changed chmod value to 755 as per @lnicola 2020-02-08 20:07:00 +02:00
Florian Diebold
c27ec69087 Remove rust-analyzer.el
The support has been moved to emacs-lsp.
2020-02-08 16:03:21 +01:00
Veetaha
5d88c1db38 vscode: amended config to use binary from globalStoragePath, added ui for downloading 2020-02-08 04:34:11 +02:00
Veetaha
3e0e4e90ae added fetchLatestArtifactMetadata() and downloadFile() functions 2020-02-08 04:34:11 +02:00
Veetaha
1bdb78a89f vscode: add FIXME about language client shared resource protection 2020-02-08 04:34:11 +02:00
bors[bot]
ea9d18ba83
Merge #3024
3024: vscode: eliminate floating promises and insane amount of resource handle leaks r=matklad a=Veetaha

Khm, yeah ...

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-05 20:57:08 +00:00
Veetaha
8153b60e1d vscode: eliminate floating promises and insane amount of resource handle leaks 2020-02-05 22:39:47 +02:00
Veetaha
49a6814048 vscode: removed changes to integrity hash in package-lock.json 2020-02-05 21:38:19 +02:00
Veetaha
b89b22e43e vscode: yet another refactor commit 2020-02-05 00:13:46 +02:00
Grégoire Geis
875dc6d1a4
Merge two if statements into one in editors/code/src/commands/on_enter.ts.
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-02-04 01:44:12 +01:00
Gregoire Geis
7fd661f085 vscode: Only handle enter if the suggest widget is hidden. 2020-02-03 22:26:20 +01:00
Gregoire Geis
b70ad7e5f3 Remove enableEnhancedTyping and type overriding infrastructure. 2020-02-03 20:24:50 +01:00
Gregoire Geis
58c007674b Change default enhanced typing behavior from using type to using keybindings. 2020-02-03 20:18:11 +01:00
Gregoire Geis
23ef22dd48 Add regular onEnter command, allowing onEnter to be called without overriding the type command. 2020-02-03 20:18:10 +01:00
Aleksey Kladov
f0323de7e8 Remove unnecessary flags 2020-02-03 18:05:54 +01:00
Aleksey Kladov
9b8e3b80ee Remove rollup-typescript
It seems like just calling typescript directly is simpler and more reliable?
2020-02-03 17:39:34 +01:00
Aleksey Kladov
0a68dfb491 Update some rollup packages 2020-02-03 16:49:25 +01:00
Aleksey Kladov
ad57726f91 Use simple prng instead of a dependency
closes #2999
2020-02-03 16:37:12 +01:00
Aleksey Kladov
30f7e6590a Remove recent improvements to the build script
tslib as a dev dependency and commonjs modules are definitely *wrong*
in the ideal world, **but** in the real world that's the only
combination that works. See

https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Problems.20with.20TypeScript.20build
2020-02-03 15:25:29 +01:00
Aleksey Kladov
ae42cfefbf Fix build of typscript extension 2020-02-03 13:54:12 +01:00
Veetaha
8f25408a12 vscode: fix bundling by switching to es2015 target modules system 2020-02-03 10:50:19 +02:00
Veetaha
0ade5cb2b3 vscode: dropped npm-check-updates script 2020-02-03 00:05:49 +02:00
Veetaha
e9800b0023 vscode: updated rollup typescript so it typechecks the bundle 2020-02-03 00:05:49 +02:00
Veetaha
2fd7af2a62 vscode: use void where possible 2020-02-02 23:24:09 +02:00
Veetaha
5411d65a7f vscode: fix, fallback to any for cmd type 2020-02-02 22:36:12 +02:00
Veetaha
12d0970f7e vscode extension: migrate from any to unknown where possible 2020-02-02 22:19:59 +02:00
Veetaha
4bf5f59560 vscode: fix type 2020-02-02 21:38:49 +02:00
Veetaha
8184752470 vscode refactoring: use more laconic export snytax, split huge string to several lines 2020-02-02 21:37:22 +02:00
Veetaha
420462421d vscode extension cleanup: migrate to prefer-const tslint rule 2020-02-02 21:12:59 +02:00
bors[bot]
856e4ba126
Merge #2979
2979: vscode: now we are actually using tslib r=matklad a=Veetaha

We had an incorrect setup where `tslib` was in `devDependencies`.
FYI:
tslib is a runtime dependency, it contains functions that are used by transpiled JavaScript in order not to inline them in each file.
For example:
```ts
// foo.ts (source code)
import * as foo from "foo";
// ---------------------------
// foo.js (compiled output)
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const foo = __importStar(require("foo"));
```
As you see, `tsc` generated that `__importStar` helper function in compiled output. And it generates it per each file if you don't enable `"importHelpers": true`. Now with `importHelpers` enabled we get the following picture:
```ts
// foo.ts (source code)
import * as foo from "foo";
// ---------------------------
// foo.js (compiled output)
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const foo = tslib_1.__importStar(require("foo"));
```
It saves some bundle size, but I am not entirely sure wheter we want that. Discussions are welcome!

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-02 14:05:23 +00:00
Veetaha
3d6d0819cc fix repo link in package.json 2020-02-02 12:16:41 +02:00
Veetaha
f08297983f vscode: moved tslib to runtime dependencies and added \"importHelpers\": true 2020-02-01 23:11:39 +02:00
bors[bot]
3f499489f7
Merge #2964
2964: Improve responsiveness of the cargo check status label r=matklad a=lnicola

This is still not ideal because the label displays the crate that was just checked, not the one that's currently being checked. But it should give the impression of being faster.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-02-01 15:41:55 +00:00
bors[bot]
a878f39b5e
Merge #2963 #2967
2963: Emacs fixes r=matklad a=flodiebold

 - use provided environment for runnables (finally set `RUST_BACKTRACE`)
 - implement `selectAndApplySourceChange` so auto-import works 🙂 

cc @brotzeit 

2967: Disable optimizations for some build-time crates r=matklad a=lnicola

This speeds up a release build on my laptop from 4m 13s to 3m 33s. It's a bit disappointing, but we don't get perfect parallelism during the build. The non-RA dependencies finish building around 72s as opposed to 112s.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-02-01 14:41:39 +00:00