1
1
mirror of https://github.com/tweag/nickel.git synced 2024-10-06 08:07:37 +03:00
Commit Graph

257 Commits

Author SHA1 Message Date
Julien Debon
79521f5c6e Fix VS Code extension Nix build
* Fix VS Code extension Nix build
  * Regenerate the 3 `node2nix` files with a more recent `node2nix`
  * Add the missing `vsce` dependency
  * Pass the `--development` flag to `node2nix` to correctly include dev
    dependencies like `typescript` or `vsce`
* Use the verbose form of `tsc` parameters in `package.json`
* Add `node2nix`, `markdownlint` and `nodejs` to the dev shell
* Add a `README.md` to the VS Code extension directory

Close https://github.com/tweag/nickel/issues/893
2022-11-24 09:57:53 +01:00
Yann Hamdaoui
a8bbad464b
tyw -> uty
Get rid of the last references of the old name of UnifType (previously
TypeWrapper) in function, macro and variable names.
2022-11-22 18:49:08 +01:00
Yann Hamdaoui
1ddf52bdeb
[CI] Add clippy check (#793)
* Print logs when running `nix flake check` in CI
* Add clippy to the flake checks and git hooks
* Clippy auto fix
  `cargo clippy --fix --workspace --no-deps --frozen --offline -- --deny warnings --allow "clippy::new-without-default" --allow "clippy::match_like_matches_macro"`
* Manually fix remaining Clippy warnings

Co-authored-by: Julien Debon <julien.debon@tweag.io>
2022-11-17 18:18:49 +01:00
Oghenevwogaga Ebresafe
b4eeeccc05
LSP completion using contract information 2022-11-16 15:13:00 +01:00
Yann Hamdaoui
077a9c276d
Row types refactoring
This commit split the previous monolithic type `Types` into separate
kinds, types, record row types, and enum row types, to forbid the
representation of ill-formed types that was previously possible.

The change required reworking a lot of type-related functions as well as
changing the API of `types` and `typechecking` in particular, but the
result seems to be more readable and better organized.
2022-11-15 18:45:43 +01:00
Oghenevwogaga Ebresafe
7730f53e34
Allow completion for nested quoted fields (#913) 2022-11-10 16:29:49 +01:00
Oghenevwogaga Ebresafe
e56b4e9184
Add support for nested record completion in the LSP (#909) 2022-11-10 10:53:13 +01:00
Oghenevwogaga Ebresafe
15a7d44f55
Replace Scope with Environment in the LSP (#906) 2022-11-04 17:31:28 +01:00
Oghenevwogaga Ebresafe
e09284231b fields -> data 2022-11-03 17:05:26 +01:00
Oghenevwogaga Ebresafe
f759146252 Merge branch 'master' into fix/lsp-record-completion 2022-11-03 16:59:24 +01:00
matthew healy
e1448bf590
[Refactor] Introduce RecordBase to share common fields between Record and RecRecord terms (#903)
* Add `RecordData` struct

Currently `Term::Record` and `Term::RecRecord` share two fields, and
some upcoming work on polymorphic record contracts will likely add a
third. To pre-empt this, this commit adds a `RecordData` struct, which
holds the shared fields & will be used by both `Term` variants.

* Refactor `Term::Record` to use new `RecordData` struct

This is just a mechanical update of the code, without any consideration
of what the ideal interface for using this new type might be.

* Refactor `Term::RecRecord` to use new `RecordData` struct

As with the previous commit, this is a basic mechanical update of the
code to use the new type.

* Add `RecordData::with_fields` constructor

* Add `RecordData::new` constructor

* Add `map_fields` and `filter_map_fields` functions to `RecordData`

These provide a consistent API for actions that occur multiple times
within the codebase - namely, iterating through a record and building a
new record using the values of each field, while optionally also
filtering certain fields out.

This allows the fields to be updated without exposing information about
the rest of the `RecordData` struct to consumers, which should make it
easier to change it in the future.

* Remove unnecessary top-level bindings

* Replace `RecordData::filter_map_fields` with specialised function

Previously `filter_map_fields` was only used for one thing: removing
empty optional values from fields while iterating. This replaces that
function with a more specialised function `map_fields_without_optionals`
which is defined in an extension on `RecordData` in the module where
it's actually needed.
2022-11-03 16:36:17 +01:00
Oghenevwogaga Ebresafe
b0c0955d14 More clean up 2022-11-03 15:06:12 +01:00
Oghenevwogaga Ebresafe
11eaed078b Clean up 2022-11-03 09:57:26 +01:00
Oghenevwogaga Ebresafe
ae7f575439 fmt. 2022-11-02 17:01:02 +01:00
Oghenevwogaga Ebresafe
d3489dc6fd Use cloned 2022-11-02 17:00:05 +01:00
Oghenevwogaga Ebresafe
2f50c97200 Remove redundant clone 2022-11-02 16:57:42 +01:00
Oghenevwogaga Ebresafe
df27c58745 Attach an env to LinearizationItem. 2022-11-02 16:52:20 +01:00
Oghenevwogaga Ebresafe
bbeb896c76 Move env back to AnalysisHost 2022-11-02 16:33:00 +01:00
Oghenevwogaga Ebresafe
40a31841b1 Revert "Use single env"
This reverts commit 06d9989667.
2022-11-02 16:17:28 +01:00
Oghenevwogaga Ebresafe
0984c6fbc0 Simplify get_identifier_before_field 2022-11-02 14:57:09 +01:00
Oghenevwogaga Ebresafe
eae11a4126 Refactor get_identifier_before_dot 2022-11-02 14:55:51 +01:00
Oghenevwogaga Ebresafe
03d51bc8ff Add tests for test_find_record_fields 2022-11-02 14:52:20 +01:00
Oghenevwogaga Ebresafe
e1b93af00d Add check to Flat contracts for record fields. 2022-11-02 10:23:49 +01:00
Oghenevwogaga Ebresafe
b7ad504eb9 Fixed fmt 2022-11-02 09:19:24 +01:00
Oghenevwogaga Ebresafe
17ab8d29f8 Add tests for remove_duplicates 2022-11-01 12:47:35 +01:00
Oghenevwogaga Ebresafe
06a53d3e0d Quote unicode field names 2022-10-31 14:28:18 +01:00
Oghenevwogaga Ebresafe
7b4250b017 vec: with_capacity(..) -> new() 2022-10-31 13:13:43 +01:00
Oghenevwogaga Ebresafe
7ffbdc310d Get unique IDs using idents in constant time. 2022-10-31 13:03:24 +01:00
Oghenevwogaga Ebresafe
89758d4f1d Use constant time Completion::get_item 2022-10-31 12:53:50 +01:00
Oghenevwogaga Ebresafe
9b4ffa5569 Allow completion after field name. 2022-10-31 12:26:00 +01:00
Oghenevwogaga Ebresafe
06d9989667 Use single env 2022-10-26 13:49:38 +01:00
Oghenevwogaga Ebresafe
f1bebaee01 Doc on identifiers 2022-10-26 12:57:04 +01:00
Oghenevwogaga Ebresafe
fe335b8461 Format 2022-10-26 12:12:14 +01:00
Oghenevwogaga Ebresafe
c66d907e0b Make dot completion a constant 2022-10-26 12:11:04 +01:00
Oghenevwogaga Ebresafe
5264e37ef9 Remove redundant Some 2022-10-26 11:59:40 +01:00
Oghenevwogaga Ebresafe
46c6188545 Refactor get_completion_identifiers 2022-10-26 11:57:43 +01:00
Oghenevwogaga Ebresafe
c0e9c6f7e8 i -> item 2022-10-26 11:46:23 +01:00
Oghenevwogaga Ebresafe
740efbad0e unwrap -> pattern matching 2022-10-26 11:44:37 +01:00
Oghenevwogaga Ebresafe
79a79ad742 Cache regex compilation. 2022-10-26 11:37:42 +01:00
Oghenevwogaga Ebresafe
35cd6a0820 Refactor into seperate function 2022-10-26 11:28:13 +01:00
Oghenevwogaga Ebresafe
332b1e26a0 doc for toplevel functions 2022-10-25 11:55:51 +01:00
Oghenevwogaga Ebresafe
11639c4cd0 Reverse regex 2022-10-25 11:51:15 +01:00
Oghenevwogaga Ebresafe
6a0d6dbf70 Move nested functions to the top level 2022-10-25 11:49:23 +01:00
Oghenevwogaga Ebresafe
d7b5741f3f Use regex to get identifier. 2022-10-25 11:42:02 +01:00
Oghenevwogaga Ebresafe
a0139582b6 Use . literal in pattern matching 2022-10-25 10:15:23 +01:00
Oghenevwogaga Ebresafe
c2707ffb31 Remove duplicate CompletionItems. 2022-10-25 10:01:25 +01:00
Oghenevwogaga Ebresafe
fd49e8d2fd Format. 2022-10-24 13:21:48 +01:00
Oghenevwogaga Ebresafe
5fd306206c Use unique IDs instead of string name. 2022-10-24 12:18:34 +01:00
Oghenevwogaga Ebresafe
70888399ec Remove Record Bind. 2022-10-21 12:48:51 +01:00
Oghenevwogaga Ebresafe
d4bdaea44b Refactor. 2022-10-19 15:16:33 +01:00