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
Show file tree
Hide file tree
Changes from 6 commits
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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"editor.formatOnSave": true,
// "editor.formatOnSave": true,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change?

"editor.detectIndentation": false,
"editor.insertSpaces": true,
"editor.tabSize": 2,
Expand Down
160 changes: 96 additions & 64 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,26 @@
"engines": {
"vscode": "^1.21.0"
},
"categories": ["Formatters", "Programming Languages", "Linters", "Snippets"],
"keywords": ["ocaml", "reason", "bucklescript", "reasonml", "merlin"],
"categories": [
"Formatters",
"Programming Languages",
"Linters",
"Snippets"
],
"keywords": [
"ocaml",
"reason",
"bucklescript",
"reasonml",
"merlin"
],
"icon": "assets/logo.png",
"activationEvents": ["onLanguage:ocaml", "onLanguage:reason"],
"activationEvents": [
"onLanguage:ocaml",
"onLanguage:reason"
],
"main": "./out/src/extension",
"contributes": {
"commands": [
{
"command": "reason.caseSplit",
"title": "Reason: Case Split"
},
{
"command": "reason.showMerlinFiles",
"title": "Reason: Show Merlin Files"
},
{
"command": "reason.showAvailableLibraries",
"title": "Reason: Show Libraries Available via Dependencies"
},
{
"command": "reason.showProjectEnv",
"title": "Reason: Show Environment"
}
],
"configuration": {
"type": "object",
"title": "Reason configuration",
Expand All @@ -60,26 +56,34 @@
"type": "integer"
},
{
"enum": ["Infinity"]
"enum": [
"Infinity"
]
}
],
"default": 500,
"description":
"How long to idle (in milliseconds) after keypresses before refreshing linter diagnostics. Smaller values refresh diagnostics more quickly."
"description": "How long to idle (in milliseconds) after keypresses before refreshing linter diagnostics. Smaller values refresh diagnostics more quickly."
},
"reason.diagnostics.tools": {
"type": "array",
"items": {
"enum": ["merlin", "bsb"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rusty-key @andreypopp One of the main advantages of this bsb integration was that bsb has full project visibility. So if one file changes and that change breaks other files, bsb is able to show those errors in the Diagnostics panel, even if the file is not opened. One has just to click on them to open the broken file, which is useful for large refactors.

Is something like that possible with merlin? I always believed that merlin only has a "local view" of the world. 🤔

"enum": [
"merlin",
"bsb"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We keep support for bsb diagnostics here?

]
},
"default": ["merlin"],
"default": [
"merlin"
],
"maxItems": 2,
"uniqueItems": true,
"description":
"Specifies which tool or tools will be used to get diagnostics. If you choose both \"merlin\" and \"bsb\", merlin will be used while editing and bsb when saving."
"description": "Specifies which tool or tools will be used to get diagnostics. If you choose both \"merlin\" and \"bsb\", merlin will be used while editing and bsb when saving."
},
"reason.format.width": {
"type": ["number", null],
"type": [
"number",
null
],
"default": null,
"description": "Set the width of lines when formatting code with refmt"
},
Expand All @@ -101,18 +105,22 @@
"reason.path.env": {
"type": "string",
"default": "env",
"description":
"The path to the `env` command which prints the language server environment for debugging editor issues."
"description": "The path to the `env` command which prints the language server environment for debugging editor issues."
},
"reason.path.ocamlformat": {
"type": "string",
"default": "ocamlformat",
"description": "The path to the `ocamlformat` binary."
},
"reason.path.ocamlmerlin": {
"type": "string",
"default": "ocamlmerlin",
"description": "The path to the `ocamlmerlin` binary."
},
"reason.path.ocpindent": {
"reason.path.ocamlmerlin-lsp": {
"type": "string",
"default": "ocp-indent",
"description": "The path to the `ocp-indent` binary."
"default": null,
"description": "The path to the `ocamlmerlin-lsp` binary."
},
"reason.path.opam": {
"type": "string",
Expand Down Expand Up @@ -142,9 +150,15 @@
"reason.server.languages": {
"type": "array",
"items": {
"enum": ["ocaml", "reason"]
"enum": [
"ocaml",
"reason"
]
},
"default": ["ocaml", "reason"],
"default": [
"ocaml",
"reason"
],
"maxItems": 2,
"uniqueItems": true,
"description": "The list of languages enable support for in the language server."
Expand Down Expand Up @@ -205,15 +219,19 @@
{
"scopeName": "markdown.reason.codeblock",
"path": "./syntaxes/reason-markdown-codeblock.json",
"injectTo": ["text.html.markdown"],
"injectTo": [
"text.html.markdown"
],
"embeddedLanguages": {
"meta.embedded.block.reason": "reason"
}
},
{
"scopeName": "markdown.ocaml.codeblock",
"path": "./syntaxes/ocaml-markdown-codeblock.json",
"injectTo": ["text.html.markdown"],
"injectTo": [
"text.html.markdown"
],
"embeddedLanguages": {
"meta.embedded.block.ocaml": "ocaml"
}
Expand All @@ -222,8 +240,13 @@
"languages": [
{
"id": "ocaml",
"aliases": ["OCaml"],
"extensions": [".ml", ".mli"],
"aliases": [
"OCaml"
],
"extensions": [
".ml",
".mli"
],
"configuration": "./ocaml.configuration.json"
},
{
Expand All @@ -234,23 +257,40 @@
},
{
"id": "ocaml.merlin",
"aliases": ["Merlin"],
"extensions": ["merlin"]
"aliases": [
"Merlin"
],
"extensions": [
"merlin"
]
},
{
"id": "ocaml.ocamlbuild",
"aliases": ["OCamlbuild"],
"extensions": ["_tags"]
"aliases": [
"OCamlbuild"
],
"extensions": [
"_tags"
]
},
{
"id": "ocaml.opam",
"aliases": ["OPAM"],
"extensions": ["opam"]
"aliases": [
"OPAM"
],
"extensions": [
"opam"
]
},
{
"id": "reason",
"aliases": ["Reason"],
"extensions": [".re", ".rei"],
"aliases": [
"Reason"
],
"extensions": [
".re",
".rei"
],
"configuration": "./reason.configuration.json"
},
{
Expand All @@ -263,15 +303,6 @@
"id": "reason.hover.type"
}
],
"menus": {
"editor/context": [
{
"command": "reason.caseSplit",
"group": "reason",
"when": "editorTextFocus && resourceLangId == reason"
}
]
},
"snippets": [
{
"language": "reason",
Expand All @@ -281,20 +312,20 @@
"problemMatchers": [
{
"name": "ocamlc",

"fileLocation": ["relative", "${workspaceFolder}"],
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"pattern": [
{
"regexp":
"^\\s*\\bFile\\b\\s*\"(.*)\",\\s*\\bline\\b\\s*(\\d+),\\s*\\bcharacters\\b\\s*(\\d+)-(\\d+)\\s*:\\s*$",
"regexp": "^\\s*\\bFile\\b\\s*\"(.*)\",\\s*\\bline\\b\\s*(\\d+),\\s*\\bcharacters\\b\\s*(\\d+)-(\\d+)\\s*:\\s*$",
"file": 1,
"line": 2,
"column": 3,
"endColumn": 4
},
{
"regexp":
"^(?:\\s*\\bParse\\b\\s*)?\\s*\\b([Ee]rror|Warning)\\b\\s*(?:\\(\\s*\\bwarning\\b\\s*(\\d+)\\))?\\s*:\\s*(.*)$",
"regexp": "^(?:\\s*\\bParse\\b\\s*)?\\s*\\b([Ee]rror|Warning)\\b\\s*(?:\\(\\s*\\bwarning\\b\\s*(\\d+)\\))?\\s*:\\s*(.*)$",
"severity": 1,
"code": 2,
"message": 3
Expand All @@ -315,15 +346,16 @@
"@types/lodash.flatmap": "^4.5.3",
"@types/node": "9.6.2",
"@types/pegjs": "0.10.0",
"@types/uuid": "^3.4.4",
"prettier": "1.11.1",
"tslint": "5.9.1",
"typescript": "2.8.1",
"vscode": "1.1.14"
},
"dependencies": {
"lodash.flatmap": "^4.5.0",
"ocaml-language-server": "1.0.35",
"pegjs": "0.10.0",
"uuid": "^3.3.2",
"vscode-jsonrpc": "3.6.0",
"vscode-languageclient": "4.0.1",
"vscode-languageserver": "4.0.0",
Expand Down
17 changes: 0 additions & 17 deletions src/client/command/doShowAvailableLibraries.ts

This file was deleted.

19 changes: 0 additions & 19 deletions src/client/command/doShowMerlinFiles.ts

This file was deleted.

25 changes: 0 additions & 25 deletions src/client/command/doShowProjectEnv.ts

This file was deleted.

Loading