Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat/add-reason-to-…
Browse files Browse the repository at this point in the history
…ast-n-pp

* origin/master: (27 commits)
  flake.lock: Update (ocamllabs#1707)
  Lock file maintenance
  Bump typescript from 5.7.2 to 5.7.3 (ocamllabs#1706)
  flake.lock: Update (ocamllabs#1703)
  Bump @types/node from 22.10.4 to 22.10.5 (ocamllabs#1702)
  Bump @types/node from 22.10.3 to 22.10.4 (ocamllabs#1701)
  Update bindings (ocamllabs#1698)
  Bump @types/node from 22.10.2 to 22.10.3 (ocamllabs#1700)
  Update Makefile
  Lock file maintenance
  Update GitHub Actions workflow
  Update Yarn to 4.6.0
  flake.lock: Update (ocamllabs#1699)
  Prepare 1.26.1 (ocamllabs#1697)
  Display message instead of empty list (ocamllabs#1695)
  fix bug (ocamllabs#1694)
  flake.lock: Update (ocamllabs#1693)
  Bump esbuild from 0.24.1 to 0.24.2 (ocamllabs#1692)
  Bump esbuild from 0.24.0 to 0.24.1 (ocamllabs#1691)
  Bump parcel from 2.13.2 to 2.13.3 (ocamllabs#1690)
  ...
  • Loading branch information
pedrobslisboa committed Jan 14, 2025
2 parents 55e2a05 + f3abe97 commit a018b3a
Show file tree
Hide file tree
Showing 19 changed files with 1,050 additions and 804 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
indent_style = tab
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
yarn install --immutable
opam install . --deps-only --with-test
- name: Run Biome checks
- name: Run biome checks
run: yarn lint

- name: Build and Package extension
- name: Build and package extension
run: opam exec -- make pkg

- name: Generate artifact attestation
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

- Add `.re` file extension support. (#1685)

## 1.26.1

- Construct: display a message when construct list is empty. (#1695)

## 1.26.0

- Add `ocaml.navigate-typed-holes` to navigate between typed holes. (#1666)

## 1.25.0

- Add `ocaml.search-by-type` to search for values using their type signature (#1626)
Expand Down
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ npm-deps:
yarn install --immutable

.PHONY: deps
deps: ## Install development dependencies
deps:
$(MAKE) npm-deps
opam install --deps-only --with-test --with-doc --with-dev-setup --yes .

Expand All @@ -21,7 +21,7 @@ create_switch:
switch: create_switch deps ## Create an opam switch and install development dependencies

.PHONY: build
build: clean ## Build the project
build: # https://github.com/ewanharris/vscode-versions
dune build src/vscode_ocaml_platform.bc.js --profile=release
yarn workspace astexplorer build
yarn esbuild _build/default/src/vscode_ocaml_platform.bc.js \
Expand All @@ -31,38 +31,38 @@ build: clean ## Build the project
--outdir=dist \
--packages=bundle \
--platform=node \
--target=es2022 \
--target=node22 \
--analyze

.PHONY: test
test: ## Run the unit tests
test:
dune build @runtest
yarn test

.PHONY: clean
clean: ## Clean build artifacts and other generated files
clean:
dune clean
$(RM) -r astexplorer/dist dist

.PHONY: doc
doc: ## Generate odoc documentation
doc:
dune build @doc

.PHONY: fmt
fmt: ## Format the codebase with ocamlformat
fmt:
dune build --auto-promote @fmt
yarn biome format --write

.PHONY: watch
watch: ## Watch for the filesystem and rebuild on every change
watch:
dune build @all -w --terminal-persistence=clear-on-rebuild

.PHONY: pkg
pkg: build # Builds and packages the extension for installment
pkg: clean build
yarn package

.PHONY: install
install: pkg # Builds, packages, and installs the extension to your VS Code
install: pkg
code --force --install-extension ocaml-platform.vsix

.PHONY:
Expand Down
6 changes: 3 additions & 3 deletions astexplorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
],
"type": "module",
"scripts": {
"build": "parcel build index.html",
"dev": "parcel watch index.html"
"build": "parcel build --no-cache index.html",
"dev": "parcel watch --no-cache index.html"
},
"dependencies": {
"font-awesome": "4.7.0",
Expand All @@ -19,6 +19,6 @@
"react-redux": "9.2.0"
},
"devDependencies": {
"parcel": "2.13.2"
"parcel": "2.13.3"
}
}
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
nativeBuildInputs = [ pkgs.ocamlPackages.gen_js_api ];
propagatedBuildInputs =
(with pkgs.ocamlPackages; [
gen_js_api
js_of_ocaml
js_of_ocaml-ppx
gen_js_api
]);
duneVersion = "3";
};
Expand All @@ -38,10 +38,10 @@
src = ./.;
duneVersion = "3";
propagatedBuildInputs = with pkgs.ocamlPackages; [
js_of_ocaml
gen_js_api
promise_jsoo
js_of_ocaml
jsonoo
promise_jsoo
];
checkInputs = with pkgs.ocamlPackages; [ ];
doCheck = true;
Expand All @@ -51,26 +51,25 @@
inherit (packages.vscode) src version;
propagatedBuildInputs = [ packages.vscode jsonoo ] ++
(with pkgs.ocamlPackages; [
js_of_ocaml
gen_js_api
base
promise_jsoo
gen_js_api
js_of_ocaml
ocaml-version
ppxlib
opam-file-format
ppxlib
promise_jsoo
]);
duneVersion = "3";
};
};
devShells.default = pkgs.mkShell {
inputsFrom = pkgs.lib.attrValues packages;
buildInputs = with pkgs.ocamlPackages; [
pkgs.yarn-berry
jsonoo
ocaml-lsp
pkgs.ocamlformat_0_26_2
pkgs.ocamlformat_0_27_0
pkgs.vscode
pkgs.nodePackages.parcel
pkgs.yarn-berry
];
shellHook = ''
make npm-deps
Expand Down
24 changes: 19 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ocaml-platform",
"displayName": "OCaml Platform",
"version": "1.25.0",
"version": "1.26.1",
"private": true,
"description": "Official OCaml language extension for VSCode",
"categories": [
Expand Down Expand Up @@ -267,6 +267,11 @@
"command": "ocaml.search-by-type",
"category": "OCaml",
"title": "Search a value by type or polarity"
},
{
"command": "ocaml.navigate-typed-holes",
"category": "OCaml",
"title": "List typed holes in the file for navigation"
}
],
"configuration": {
Expand Down Expand Up @@ -311,6 +316,11 @@
"default": false,
"markdownDescription": "Enable/Disable syntax documentation"
},
"ocaml.commands.typedHoles.constructAfterNavigate": {
"type": "boolean",
"default": false,
"markdownDescription": "When enabled, list values that can fill a typed hole after navigating to it."
},
"ocaml.commands.construct.recursiveCalls": {
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -1081,6 +1091,10 @@
{
"command": "ocaml.search-by-type",
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.ocamllex"
},
{
"command": "ocaml.navigate-typed-holes",
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason"
}
],
"editor/title": [
Expand Down Expand Up @@ -1262,16 +1276,16 @@
"@biomejs/biome": "1.9.4",
"@tsconfig/node22": "22.0.0",
"@tsconfig/strictest": "2.0.5",
"@types/node": "22.10.2",
"@types/node": "22.10.5",
"@types/vscode": "1.86.0",
"@vscode/test-cli": "0.0.10",
"@vscode/test-electron": "2.4.1",
"@vscode/vsce": "3.2.1",
"esbuild": "0.24.0",
"esbuild": "0.24.2",
"ovsx": "0.10.1",
"typescript": "5.7.2"
"typescript": "5.7.3"
},
"packageManager": "yarn@4.5.3",
"packageManager": "yarn@4.6.0",
"engines": {
"vscode": "^1.86.0"
},
Expand Down
36 changes: 30 additions & 6 deletions src-bindings/node/node.ml
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,47 @@ module Path = struct
;;
end

module Constants = struct
type t = R_OK

include [%js: val r_ok : Ojs.t [@@js.global "constants.R_OK"]]

let t_to_js = function
| R_OK -> r_ok
;;
end

module Fs = struct
module ReadFileOptions = struct
include Interface.Make ()
include [%js: val create : encoding:string -> t [@@js.builder]]
end

include
[%js:
val readDir : string -> string list Promise.t [@@js.global "fs.readDir"]
val access : string -> mode:Constants.t -> unit Promise.t [@@js.global "fs.access"]
val readdir : string -> string list Promise.t [@@js.global "fs.readdir"]

val readFile : string -> encoding:string -> string Promise.t
[@@js.global "fs.readFile"]
val readFile : string -> options:ReadFileOptions.t -> string Promise.t
[@@js.global "fs.readFile"]]

val exists : string -> bool Promise.t [@@js.global "fs.exists"]]
let exists path =
access path ~mode:Constants.R_OK
|> Promise.then_
~fulfilled:(fun _ -> Promise.return true)
~rejected:(fun _ -> Promise.return false)
;;

let readDir path =
readDir path
readdir path
|> Promise.then_ ~fulfilled:Promise.Result.return ~rejected:(fun error ->
Promise.return (Error (JsError.message error)))
;;

let readFile = readFile ~encoding:"utf8"
let readFile =
let options = ReadFileOptions.create ~encoding:"utf8" in
readFile ~options
;;
end

module Net = struct
Expand Down
22 changes: 6 additions & 16 deletions src-bindings/node/node_stub.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
const fs = require("node:fs");
const { promisify } = require("node:util");

joo_global_object.fs = {
readDir: promisify(fs.readdir),
readFile: promisify(fs.readFile),
exists: promisify(fs.exists),
};

joo_global_object.child_process = require("node:child_process");

joo_global_object.path = require("node:path");

joo_global_object.os = require("node:os");

joo_global_object.net = require("node:net");
globalThis.child_process = require("node:child_process");
globalThis.constants = require("node:constants");
globalThis.fs = require("node:fs/promises");
globalThis.net = require("node:net");
globalThis.os = require("node:os");
globalThis.path = require("node:path");
4 changes: 2 additions & 2 deletions src-bindings/polka/polka_stub.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
joo_global_object.polka = require("polka");
joo_global_object.sirv = require("sirv");
globalThis.polka = require("polka");
globalThis.sirv = require("sirv");
2 changes: 1 addition & 1 deletion src-bindings/vscode/vscode_stub.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
joo_global_object.vscode = require("vscode");
globalThis.vscode = require("vscode");
Original file line number Diff line number Diff line change
@@ -1 +1 @@
joo_global_object.vscode_languageclient = require("vscode-languageclient");
globalThis.vscode_languageclient = require("vscode-languageclient");
Loading

0 comments on commit a018b3a

Please sign in to comment.