Commit Graph

7279 Commits

Author SHA1 Message Date
Veetaha
58e01d8754 ra_syntax: rename first_token() -> lex_first_token() 2020-02-04 00:00:55 +02:00
Veetaha
b1764d85fc ra_syntax: fixed a typo in doc comment 2020-02-04 00:00:55 +02:00
Veetaha
9e7eaa959f ra_syntax: refactored the lexer design as per @matklad and @kiljacken PR review 2020-02-04 00:00:55 +02:00
Veetaha
bf60661aa3 ra_syntax: remove backticks from TokenizeError message since that is not Markdown ;( 2020-02-04 00:00:55 +02:00
Veetaha
c6d0881382 add better docs for tokenize errors 2020-02-04 00:00:55 +02:00
Veetaha
ffe00631d5 ra_syntax: moved ParsedToken derive attribute under the doc comment 2020-02-04 00:00:55 +02:00
Veetaha
a2bc4c2a74 ra_syntax: fixed doc comment 2020-02-04 00:00:55 +02:00
Veetaha
ac37a11f04 Reimplemented lexer with vectors instead of iterators 2020-02-04 00:00:55 +02:00
Veetaha
ad24976da3 ra_syntax: changed added diagnostics information returned from tokenize() (implemented with iterators) 2020-02-04 00:00:55 +02:00
bors[bot]
b090ee5a65
Merge #3003
3003: Remove rollup-typescript r=matklad a=matklad

It seems like just calling typescript directly is simpler and more reliable?


@Veetaha what do you think about this approach?

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-03 17:11:36 +00: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
bors[bot]
8d18b151e4
Merge #3002
3002: Update some rollup packages r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-03 15:49:56 +00:00
Aleksey Kladov
0a68dfb491 Update some rollup packages 2020-02-03 16:49:25 +01:00
bors[bot]
35e0c706d8
Merge #3001
3001: Use simple prng instead of a dependency r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-03 15:38:27 +00:00
Aleksey Kladov
ad57726f91 Use simple prng instead of a dependency
closes #2999
2020-02-03 16:37:12 +01:00
bors[bot]
056a01502b
Merge #2997
2997: Use proper import name in the label r=matklad a=SomeoneToIgnore



Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-02-03 14:34:16 +00:00
bors[bot]
c57ed0cfb2
Merge #2998
2998: Remove recent improvements to the build script r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-03 14:26:22 +00: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
Kirill Bulatov
bfbc5e2d37 Use proper import name in the label 2020-02-03 15:44:28 +02:00
bors[bot]
834fcecd31
Merge #2994
2994: Small cleanup r=matklad a=SomeoneToIgnore

A follow-up to https://github.com/rust-analyzer/rust-analyzer/pull/2990#discussion_r374044482

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-02-03 13:01:58 +00:00
bors[bot]
d828ea5351
Merge #2995
2995: Fix build of typscript extension r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-03 12:54:44 +00:00
Aleksey Kladov
ae42cfefbf Fix build of typscript extension 2020-02-03 13:54:12 +01:00
Kirill Bulatov
4f27155d5c Simplify paths searches 2020-02-03 13:56:03 +02:00
Kirill Bulatov
fcf5bbbbeb Fix inlay hints test snippet compilation 2020-02-03 13:35:14 +02:00
bors[bot]
d400fde66c
Merge #2959
2959: Rework how we send diagnostics to client r=matklad a=kiljacken

The previous way of sending from the thread pool suffered from stale diagnostics due to being canceled before we could clear the old ones.

The key change is moving to sending diagnostics from the main loop thread, but doing all the hard work in the thread pool. This should provide the best of both worlds, with little to no of the downsides.

This should hopefully fix a lot of issues, but we'll need testing in each individual issue to be sure.

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2020-02-03 11:27:31 +00:00
Emil Lauridsen
9f70f443a3 Update snapshot tests due to removed SuggestedFix 2020-02-03 12:24:57 +01:00
Emil Lauridsen
cde20bf8f0 Remove stray todo 2020-02-03 12:18:06 +01:00
bors[bot]
5b1b2cac39
Merge #2990
2990: Use name only when searching for an import candidate r=me a=SomeoneToIgnore



Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-02-03 11:10:55 +00:00
Emil Lauridsen
790788d5f4 Rework how we send diagnostics to client.
The previous way of sending from the thread pool suffered from stale
diagnostics due to being canceled before we could clear the old ones.

The key change is moving to sending diagnostics from the main loop
thread, but doing all the hard work in the thread pool. This should
provide the best of both worlds, with little to no of the downsides.

This should hopefully fix a lot of issues, but we'll need testing in
each individual issue to be sure.
2020-02-03 11:34:24 +01:00
bors[bot]
52456c4490
Merge #2993
2993: vscode: fix bundling by switching to es2015 target modules system r=matklad a=Veetaha

Quick fix

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-03 08:54:04 +00:00
Veetaha
8f25408a12 vscode: fix bundling by switching to es2015 target modules system 2020-02-03 10:50:19 +02:00
bors[bot]
dbb235ed07
Merge #2991
2991: vscode: updated rollup typescript so it typechecks the bundle r=Veetaha a=Veetaha

See [this happy update](https://github.com/rollup/plugins/blob/master/packages/typescript/CHANGELOG.md#v300) from `@rollup/typescript-plugin` changelog)

I also added a utility script to view the latest dependencies versions (`dry-run` variant) and update them in batch. Beware, that it bumps versions even if the major version of them has changed (for updating only within one major version there is a cli option, but I didn't want add a whole bunch of scripts)
Some of the dependencies major versions are out of date:
```
~/my/projects/rust-analyzer/editors/code (feature/refactoring-vscode-ext) $ npm run bump-deps:dry-run

> rust-analyzer@0.1.0 bump-deps:dry-run /home/veetaha/my/projects/rust-analyzer/editors/code
> npm-check-updates

Checking /home/veetaha/my/projects/rust-analyzer/editors/code/package.json
[====================] 16/16 100%

 jsonc-parser                    ^2.1.0  →   ^2.2.0 
 @rollup/plugin-commonjs        ^11.0.1  →  ^11.0.2 
 @rollup/plugin-node-resolve     ^6.1.0  →   ^7.1.0 
 @types/node                  ^12.12.25  →  ^13.7.0 
 rollup                         ^1.30.1  →  ^1.31.0 
 tslint                         ^5.20.1  →   ^6.0.0 
 vsce                           ^1.71.0  →  ^1.72.0 
```

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-02 22:21:23 +00: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
bors[bot]
ae16884b95
Merge #2989
2989: vscode extension: migrate from any to unknown where possible r=Veetaha a=Veetaha

`unknown` type is the stricter version of `any` and it should always be prefered (like `const` over `let`).
It lets you assign any value to it, but doesn't let you carry out arbitrary operations on them without an explicit type check (like `typeof unknownValue === 'string'`).

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-02 21:27:58 +00:00
Kirill Bulatov
01d59f4a32 Use name only when searching for an import candidate 2020-02-02 23:27:20 +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
bors[bot]
5e61c9b11d
Merge #2987
2987: vscode refactoring: use more laconic export snytax, split huge string literal r=matklad a=Veetaha



Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-02 19:40:28 +00: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
bors[bot]
e72771ebc6
Merge #2986
2986: vscode extension cleanup: migrate to prefer-const tslint rule r=matklad a=Veetaha



Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-02 19:20:42 +00:00
Veetaha
420462421d vscode extension cleanup: migrate to prefer-const tslint rule 2020-02-02 21:12:59 +02:00
bors[bot]
d06e02dd13
Merge #2985
2985: Avoid premature pessimization r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-02 17:57:40 +00:00
Aleksey Kladov
24ad1cce2c Avoid premature pessimization
The extra allocation for message should not matter here at all, but
using a static string is just as ergonomic, if not more, and there's
no reason to write deliberately slow code
2020-02-02 18:56:37 +01: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
bors[bot]
9006cec492
Merge #2983
2983: Fix repo link in package.json r=matklad a=Veetaha

Fix repo link

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-02 13:57:17 +00:00
bors[bot]
e24829909a
Merge #2982
2982: Merge imports when auto importing r=flodiebold a=SomeoneToIgnore



Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-02-02 13:06:14 +00:00