Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Migrate to ocamlmerlin-lsp #269

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4637b8a
WIP: support for ocamlmerlin-lsp
andreypopp Jan 31, 2019
1072823
use merlin-lsp for all projects
rusty-key Feb 24, 2019
aec1eac
remove ols-related code
rusty-key Feb 28, 2019
a4c1821
add formatters
rusty-key Feb 28, 2019
d52fee6
use temp files to better handle large files
rusty-key Feb 28, 2019
57590da
fix formatting
rusty-key Feb 28, 2019
690f2a4
revert unrelated change
rusty-key Mar 10, 2019
c705687
tweak options format
rusty-key Mar 10, 2019
32fe6d3
handle possible errors
rusty-key Mar 10, 2019
798219e
remove debug
rusty-key Mar 10, 2019
8bd13e5
remove unsupported settings
rusty-key Mar 10, 2019
7000de8
prebuild merlin-lsp/merlin-reason and use them for reason projects
rusty-key Mar 29, 2019
8f44e4e
use platform’s tmp dir
rusty-key Mar 29, 2019
ce09262
fix lsp binaries
rusty-key Mar 30, 2019
c6d6408
remove ocamlfind dependency
rusty-key Mar 30, 2019
bf91e25
get rid of custom paths
rusty-key Apr 5, 2019
280112c
add some checks
rusty-key Apr 5, 2019
8e11395
use esy for formatters
rusty-key Apr 5, 2019
9ae3159
fix code style
rusty-key Apr 5, 2019
be95b57
add local opam switch support
Khady Apr 8, 2019
9e7085d
Merge pull request #1 from Khady/opam-switch-support
rusty-key Apr 8, 2019
b06b7ec
add restart ls command
rusty-key Apr 8, 2019
9c7682d
fix refmt’s temp file extension
rusty-key Apr 8, 2019
6a75a9a
remove debug
rusty-key Apr 8, 2019
7e1dc9d
add esy.json generation for bs projects
rusty-key Apr 11, 2019
a6c0889
add resolutions for 4.02
rusty-key Apr 11, 2019
d5845d8
ignore packaged extensions
rusty-key Apr 22, 2019
6c78709
init merlin-lsp when it is installed
rusty-key Apr 22, 2019
c95bbc2
"simplify" extension setup
rusty-key Jul 20, 2019
c7c77e4
pass ocamlmerlin-reason path
rusty-key Jul 21, 2019
520bdd4
describe 4.02 setup
rusty-key Jul 21, 2019
2b66c0e
update readme
rusty-key Jul 21, 2019
be6cac2
remove unused utils
rusty-key Jul 21, 2019
c759a28
fix version
rusty-key Jul 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add resolutions for 4.02
  • Loading branch information
rusty-key committed Apr 11, 2019
commit a6c08899be4288f267fe0cc242f39628f7aaf801
94 changes: 67 additions & 27 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,37 +121,53 @@ function generateEsyConfig() {
return null;
}

const ocamlVersion = semver.gtr("6.0.0", bsPlatformVersion) ? "4.02.x" : "4.06.x";

return JSON.stringify(
{
name: packageJsonConfig.name,
version: packageJsonConfig.version,
devDependencies: {
"@opam/merlin-lsp": "*",
ocaml: ocamlVersion,
},
resolutions: {
"@opam/merlin-lsp": "github:ocaml/merlin:merlin-lsp.opam#517f577",
},
comments: [
"This file is used to help esy install the required binaries for vscode-reasonml extension",
"The `ocaml` package version will have to be updated if you change bs-platform in package.json to a version that",
"depends on a different version of the OCaml compiler (for example, from 4.02 to 4.06).",
],
},
null,
" ",
);

const baseEsyConfig = {
name: packageJsonConfig.name,
version: packageJsonConfig.version,
comments: [
"This file is used to help esy install the required binaries for vscode-reasonml extension",
"The `ocaml` package version will have to be updated if you change bs-platform in package.json to a version that",
"depends on a different version of the OCaml compiler (for example, from 4.02 to 4.06).",
],
};
/* tslint:disable:object-literal-key-quotes */
const esyConfig = semver.gtr("6.0.0", bsPlatformVersion)
? {
...baseEsyConfig,
devDependencies: {
"@opam/merlin-lsp": "*",
ocaml: "4.2.x",
},
resolutions: {
"@opam/ppx_deriving": {
source: "github:ocaml-ppx/ppx_deriving:opam#71e61a2",
override: {
build: ["ocaml pkg/build.ml native=true native-dynlink=true"],
},
},
"@opam/merlin-lsp": "github:Khady/merlin:merlin-lsp.opam#9325d1d",
},
}
: {
...baseEsyConfig,
devDependencies: {
"@opam/merlin-lsp": "*",
ocaml: "4.06.x",
},
resolutions: {
"@opam/merlin-lsp": "github:ocaml/merlin:merlin-lsp.opam#517f577",
},
};
/* tslint:disable:object-literal-key-quotes */
return JSON.stringify(esyConfig, null, " ");
}

export function activate(context: vscode.ExtensionContext) {
export async function activate(context: vscode.ExtensionContext) {
function start() {
client.launch(context);
}

function init() {
async function init() {
if (!isBucklescriptProject) return;

const rootPath = vscode.workspace.rootPath;
Expand All @@ -164,8 +180,32 @@ export function activate(context: vscode.ExtensionContext) {
return;
}

fs.writeFileSync(esyJsonPath, esyConfig);
vscode.window.showInformationMessage("All good. Now run `esy`");
const choice = await vscode.window.showQuickPick(
[
{
description: "An `esy.json` file will be created on the root of the project.",
label: "Yes",
},
{
description: "The extension will not provide any diagnostics without it.",
label: "No",
},
],
{ placeHolder: "`esy.json` was not found in the project. Do you want the extension to create one for you?" },
);

if (choice && choice.label === "Yes") {
fs.writeFileSync(esyJsonPath, esyConfig);
vscode.window.showQuickPick(
[
{
description: "",
label: "Ok",
},
],
{ placeHolder: "All good. Now run `esy`" },
);
}
}

context.subscriptions.push(vscode.languages.setLanguageConfiguration("reason", reasonConfiguration));
Expand Down