Skip to content

Commit

Permalink
Merge branch 'master' into typed_holes
Browse files Browse the repository at this point in the history
  • Loading branch information
PizieDust authored Dec 6, 2024
2 parents c30317d + 6a7b951 commit e78f4b3
Show file tree
Hide file tree
Showing 15 changed files with 273 additions and 287 deletions.
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 5
dune-cache: true

- name: Set-up Node.js
uses: actions/setup-node@v4
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Unreleased

- Add `ocaml.navigate-typed-holes` to navigate to different typed holes. (#1666)
- Add `ocaml.commands.construct.recursiveCalls` setting to configure construct chaining. (#1673)

## 1.23.0

Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,22 @@ to `ocamllsp`.
This extension provides options in VSCode's configuration settings. You can find
the settings under `File > Preferences > Settings`.

| Name | Description | Default |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------- | ------- |
| `ocaml.sandbox` | Determines where to find the sandbox for a given project | `null` |
| `ocaml.dune.autoDetect` | Controls whether dune tasks should be automatically detected. | `true` |
| `ocaml.trace.server` | Controls the logging output of the language server. Valid settings are `off`, `messages`, or `verbose`. | `off` |
| `ocaml.useOcamlEnv` | Controls whether to use ocaml-env (if available) for opam commands from OCaml for Windows. | `true` |
| `ocaml.terminal.shell.linux` | The path of the shell that the sandbox terminal uses on Linux | `null` |
| `ocaml.terminal.shell.osx` | The path of the shell that the sandbox terminal uses on macOS | `null` |
| `ocaml.terminal.shell.windows` | The path of the shell that the sandbox terminal uses on Windows | `null` |
| `ocaml.terminal.shellArgs.linux` | The command line arguments that the sandbox terminal uses on Linux | `null` |
| `ocaml.terminal.shellArgs.osx` | The command line arguments that the sandbox terminal uses on macOS | `null` |
| `ocaml.terminal.shellArgs.windows` | The command line arguments that the sandbox terminal uses on Window | `null` |
| `ocaml.repl.path` | The path of the REPL that the extension uses | `null` |
| `ocaml.repl.args` | The REPL arguments that the extension uses | `null` |
| `ocaml.repl.useUtop` | Controls whether to use Utop for the REPL if it is installed in the current switch. | `true` |
| Name | Description | Default |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------- |
| `ocaml.sandbox` | Determines where to find the sandbox for a given project | `null` |
| `ocaml.dune.autoDetect` | Controls whether dune tasks should be automatically detected. | `true` |
| `ocaml.trace.server` | Controls the logging output of the language server. Valid settings are `off`, `messages`, or `verbose`. | `off` |
| `ocaml.useOcamlEnv` | Controls whether to use ocaml-env (if available) for opam commands from OCaml for Windows. | `true` |
| `ocaml.terminal.shell.linux` | The path of the shell that the sandbox terminal uses on Linux | `null` |
| `ocaml.terminal.shell.osx` | The path of the shell that the sandbox terminal uses on macOS | `null` |
| `ocaml.terminal.shell.windows` | The path of the shell that the sandbox terminal uses on Windows | `null` |
| `ocaml.terminal.shellArgs.linux` | The command line arguments that the sandbox terminal uses on Linux | `null` |
| `ocaml.terminal.shellArgs.osx` | The command line arguments that the sandbox terminal uses on macOS | `null` |
| `ocaml.terminal.shellArgs.windows` | The command line arguments that the sandbox terminal uses on Window | `null` |
| `ocaml.repl.path` | The path of the REPL that the extension uses | `null` |
| `ocaml.repl.args` | The REPL arguments that the extension uses | `null` |
| `ocaml.repl.useUtop` | Controls whether to use Utop for the REPL if it is installed in the current switch. | `true` |
| `ocaml.commands.construct.recursiveCalls` | When enabled, the construct command will execute again on the next hole after a value has been chosen. | `true` |

If `ocaml.terminal.shell.*` or `ocaml.terminal.shellArgs.*` is `null`, the
configured VSCode shell and shell arguments will be used instead.
Expand Down
8 changes: 4 additions & 4 deletions astexplorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
],
"type": "module",
"scripts": {
"build": "parcel build --no-cache index.html",
"dev": "parcel watch --no-cache index.html"
"build": "parcel build index.html",
"dev": "parcel watch index.html"
},
"dependencies": {
"font-awesome": "4.7.0",
"json-stringify-safe": "5.0.1",
"process": "0.11.10",
"prop-types": "15.8.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-redux": "9.1.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion astexplorer/src/components/ASTOutput.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import PropTypes from "prop-types";
import React from "react";
import cx from "../utils/classnames.js";
import visualizations from "./visualization";
import { vscode } from "../vscode";
import visualizations from "./visualization";

const { useState } = React;

Expand Down
8 changes: 4 additions & 4 deletions astexplorer/src/components/visualization/Tree.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Element from "./tree/Element";
import PropTypes from "prop-types";
import React from "react";
import { publish } from "../../utils/pubsub.js";
import { logEvent } from "../../utils/logger";
import { treeAdapterFromParseResult } from "../../core/TreeAdapter.js";
import { logEvent } from "../../utils/logger";
import { publish } from "../../utils/pubsub.js";
import { vscode } from "../../vscode";
import { SelectedNodeProvider } from "./SelectedNodeContext.js";
import focusNodes from "./focusNodes.js";
import { vscode } from "../../vscode";
import Element from "./tree/Element";

import "./css/tree.css";

Expand Down
10 changes: 5 additions & 5 deletions astexplorer/src/components/visualization/tree/Element.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import CompactArrayView from "./CompactArrayView";
import CompactObjectView from "./CompactObjectView";
import PropTypes from "prop-types";
import { publish } from "../../../utils/pubsub.js";
import React from "react";
import { useSelectedNode } from "../SelectedNodeContext.js";
import focusNodes from "../focusNodes.js";
import cx from "../../../utils/classnames.js";
import { publish } from "../../../utils/pubsub.js";
import stringify from "../../../utils/stringify";
import { vscode } from "../../../vscode.js";
import { useSelectedNode } from "../SelectedNodeContext.js";
import focusNodes from "../focusNodes.js";
import CompactArrayView from "./CompactArrayView";
import CompactObjectView from "./CompactObjectView";

const { useState, useRef, useMemo, useCallback, useEffect } = React;
function usePrevious(value, initialValue) {
Expand Down
6 changes: 4 additions & 2 deletions astexplorer/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import ReactDOM from "react-dom";
import ReactDOM from "react-dom/client";
import InteractorFactory from "./Interaction/InteractorFactory";
import ASTOutput from "./components/ASTOutput";
import getTreeAdapter from "./parserMiddleware";
Expand Down Expand Up @@ -93,4 +93,6 @@ class Index extends React.Component {
}
}

ReactDOM.render(<Index />, document.getElementById("index"));
const root = ReactDOM.createRoot(document.getElementById("index"));

root.render(<Index />);
2 changes: 1 addition & 1 deletion astexplorer/src/parserMiddleware.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
emptyKeysFilter,
ignoreKeysFilter,
locationInformationFilter,
emptyKeysFilter,
typeKeysFilter,
} from "./core/TreeAdapter.js";

Expand Down
5 changes: 2 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"$schema": "node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": ["astexplorer", "esy.lock", "package.json"]
},
"formatter": {
"enabled": true,
"ignore": ["package.json"],
"useEditorconfig": true
},
"linter": {
"enabled": true,
"ignore": ["astexplorer"],
"rules": {
"recommended": true
}
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@
"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,
"markdownDescription": "When enabled, the construct command will execute again on the next hole after a value has been chosen."
},
"ocaml.dune.autoDetect": {
"type": "boolean",
Expand Down
31 changes: 17 additions & 14 deletions src/extension_commands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -609,20 +609,23 @@ module Construct = struct
match selected_result with
| Some (value, range) -> (
let* value_inserted = insert_to_document text_editor range value in
match value_inserted with
| true -> (
let* new_range =
Holes_commands.closest_hole
(Range.start range)
text_editor
client
`Next
in
match new_range with
| Some range ->
process_construct (Range.end_ range) text_editor client instance
| None -> Promise.return ())
| false -> Promise.return ())
match Settings.(get server_constructRecursiveCalls_setting) with
| Some true | None -> (
match value_inserted with
| true -> (
let* new_range =
Holes_commands.closest_hole
(Range.start range)
text_editor
client
`Next
in
match new_range with
| Some range ->
process_construct (Range.end_ range) text_editor client instance
| None -> Promise.return ())
| false -> Promise.return ())
| Some false -> Promise.return ())
| None -> Promise.return ()

let _construct =
Expand Down
5 changes: 5 additions & 0 deletions src/settings.ml
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,10 @@ let server_typedHolesConstructAfterNavigate_setting =
create_setting
~scope:ConfigurationTarget.Workspace
~key:"ocaml.commands.typedHoles.constructAfterNavigate"

let server_constructRecursiveCalls_setting =
create_setting
~scope:ConfigurationTarget.Workspace
~key:"ocaml.commands.construct.recursiveCalls"
~of_json:Jsonoo.Decode.bool
~to_json:Jsonoo.Encode.bool
2 changes: 2 additions & 0 deletions src/settings.mli
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ val server_duneDiagnostics_setting : bool setting
val server_syntaxDocumentation_setting : bool setting

val server_typedHolesConstructAfterNavigate_setting : bool setting

val server_constructRecursiveCalls_setting : bool setting
Loading

0 comments on commit e78f4b3

Please sign in to comment.