Commit graph

21 commits

Author SHA1 Message Date
glacambre
9ef99b0ab4
parsers/exmode.ts: replace macro-generated info with ts-generated info
I tested nearly all ex commands and this didn't seem to break anything.
2019-05-31 15:20:46 +02:00
glacambre
03953315a8
compiler: add info about optional/rest arguments 2019-05-31 13:58:27 +02:00
glacambre
96a9dde5b8
gen_metadata.ts: Fix compiler pass not working with typescript 3.5.1
TypeScript 3.5.1 added a new 'Unknown' keyword which behaves similarly
to any, except when assigning a value to a variable that already holds a
value. This is not something we care about and so we can just treat it
as any.
2019-05-30 15:35:50 +02:00
glacambre
51f88f51c9
Fix errors found by LGTM
https://lgtm.com/projects/g/tridactyl/tridactyl/overview/
2019-04-17 07:18:18 +02:00
glacambre
923f9caf92
TSLint: enable no-unused-declaration rule
This rule requires adding a new set of rules, tslint-etc.
no-unused-declaration used to be available in tslint:recommended but was
deprecated when --noUnusedVariables was added to typescript. The problem
with using TypeScript's --noUnusedVariables is that it turns unused
declarations into an error and prevents compilation, which isn't fun
when you're just prototyping things.
2019-04-16 08:30:31 +02:00
glacambre
3fe1e5a091
TSLint: re-enable no-empty rule 2019-04-14 10:27:22 +02:00
glacambre
85706a4347
TSLint: re-enable radix rule 2019-04-05 13:16:04 +02:00
glacambre
bcd04a349c
Make compiler tslint/tslint-sonarts ready 2019-03-31 13:30:47 +02:00
Oliver Blanthorn
be2618c352
Merge branch 'config_api' 2018-12-13 13:03:42 +00:00
glacambre
a808e9e742
Metadata Types: Use a single type instance where it makes sense
One of the possible problems of #1184 (firefox freezing periodically
with Tridactyl enabled) is that Tridactyl uses too much RAM, which could
cause Firefox to attempt to GC it from time to time.
One easy optimisation to try to reduce this problem is to use singletons
for metadata when possible (VoidType, AnyType...).
According to my measurements, this saves the allocation of 933 objects,
which amounted to ~0.03MB. Multiply this by 40 tabs and you get about
1.20MB saved, the space of a whole 1980-era floppy disk.
2018-11-21 06:56:01 +01:00
glacambre
862e2750f6
compiler/gen_metadata.ts: Kludge IndexedAccessTypes
IndexedAccessTypes are things like Class[T] in the following function
declaration:
function fn<T keyof Class>(x: T, y: Class[T])
I do not see an easy way to take this into account for now so I'm just
replacing it with Any, hopefully we'll never actually need precise
metadata for types like this.
2018-11-20 19:51:46 +01:00
glacambre
dfbae7ed06
UnionType.ts: Improve error message on failed conversions.
Closes https://github.com/tridactyl/tridactyl/issues/1146.
2018-11-12 19:10:54 +01:00
glacambre
ba2537cf04
Completions: do not show @hidden excmds 2018-11-07 08:39:36 +01:00
glacambre
ecc936ea7e
compiler: Add information about @hidden symbols to metadata 2018-11-07 08:12:53 +01:00
glacambre
b5da7705e9
Improve generated metadata types for objects
Before this commit, the compiler pass that generated metadata for
settings didn't generate informetion precise enough to be used to
validate settings that existed in objects (e.g. `logging.cmdline`).

This resulted in no typechecking being done for these settings (e.g.
`:set logging.cmdline 1` would not throw any errors). This commit fixes
that.
2018-11-04 17:28:15 +01:00
glacambre
4d0f7c84eb
Make the generated metadata typed
This commit makes the compiler pass use different classes in order to
represent the metadata. This enables adding per-class toString/convert
functions. This enables easy type checking and conversion in the `:set`
excmd.
2018-11-04 17:24:16 +01:00
glacambre
d705cbe8dc
gen_metadata.ts: Add metadata generation for classes
We now generate doc/type metadata for classes. In order to do this, we
added a level of indirection to the metadata object, this makes telling
the difference between classes and functions easier.
2018-09-01 21:51:08 +02:00
glacambre
16165f9935
Make Excmd completion type simpler
This commit makes type information generated by our compiler pass more
precise. This lets us choose what information we want to display in the
command line.
2018-08-20 18:12:46 +02:00
Anton Vilhelm Ásgeirsson
4c856621c5 Assert type of node object. 2018-08-19 12:08:49 +00:00
glacambre
b13956010c
Add list of static themes to generated metadata 2018-08-16 20:56:19 +02:00
glacambre
35466971b7
Implement basic excmd completion
This implements excmd completion. We're using the typescript compiler
API in order to get the documentation and the type of every function of
Tridactyl and generate a file named "src/metadata.ts" which contains
this information. Since this file is dependency-less it can be imported
from every source file.

We then write a regular completion source which just uses the data
contained in metadata.ts in order to generate its completions.
2018-08-05 17:12:49 +02:00