Giter VIP home page Giter VIP logo

vim-rescript's Introduction

vim-rescript

Vim runtime files for ReScript.

If you are experiencing any troubles, open an issue or visit our Forum and ask for guidance.

Features

  • Syntax highlighting for ReSript files
  • Filetype detection for .res, .resi
  • Basic automatic indentation

See :h rescript for the detailed helpfile.

Installation

vim-rescript can be installed either manually or by using your favourite plugin manager.

" vim-plug
Plug 'rescript-lang/vim-rescript'

" Vundle
Plugin 'rescript-lang/vim-rescript'

" NeoBundle
NeoBundle 'rescript-lang/vim-rescript'
-- Lazy.nvim
{ 'rescript-lang/vim-rescript', ft="rescript" }

You can also pin your installation to specific tags (check our releases here):

With Plug:

Plug 'rescript-lang/vim-rescript', {'tag': 'v2.1.0'}

With Lazy.nvim:

{ 'rescript-lang/vim-rescript', tag = "v2.1.0" }

Setup LSP

First you need install the language server for ReScript from npm

Note If you are using mason.nvim you can install the ReScript Language Server using the command MasonInstall rescript-language-server

npm install -g @rescript/language-server

The binary is called rescript-language-server

Neovim LSP builtin

Install the nvim-lspconfig package and setup the LSP

local lspconfig = require('lspconfig')

lspconfig.rescriptls.setup{}

For more details, see server configuration

COC (Vim or Neovim)

(:h rescript-coc)

After the installation, open your coc config (:CocConfig) and add the following configuration:

"languageserver": {
  "rescript": {
    "enable": true,
    "module": "rescript-language-server",
    "args": ["--node-ipc"],
    "filetypes": ["rescript"],
    "rootPatterns": ["rescript.json", "bsconfig.json"]
  }
}

Credits

  • amirales: Started the plugin w/ syntax & indent functionality

vim-rescript's People

Contributors

amiralies avatar aspeddro avatar danwetherald avatar ellbee avatar ryyppy avatar sallescosta avatar smh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vim-rescript's Issues

vim-rescript errors

the extension seems to work fine, including syntax highlighting and all coc features, but I keep getting a variety of errors when I switch to an already open buffer. Here are some that I've seen:

Error detected while processing BufReadPost Autocommands for "*.res":                                                                                                                                                                                                                                        
E492: Not an editor command: *.resi call rescript#UpdateProjectEnv()  

or

Error detected while processing function 349[32]..<SNR>44_callback:                                                                                                                                                                                                                                          
line   21:                                                                                                                                                                                                                                                                                                   
Vim:E492: Not an editor command: *.resi call rescript#UpdateProjectEnv() 

or

Error detected while processing BufReadPost Autocommands for "*.res":                                                                                                                                                                                                                              
E20: Mark not set

I suspect this may be because I'm using neovim-nightly:

$ nvim -v
NVIM v0.5.0-dev+cc1851c9f
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210201-58996-1y3lpnp/build/config -I/tmp/neovim-20210201-58996-1y3lpnp/src -I/usr/local/include -I/tmp/neovim-20210201-58996-1y3lpnp/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20210201-58996-1y3lpnp/build/src/nvim/auto -I/tmp/neovim-20210201-58996-1y3lpnp/build/include
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-cc1851c/share/nvim"

Run :checkhealth for more info

My full init.vim is here: https://gist.github.com/dusty-phillips/572ec4dca1c7697d975041c905f6350a

But I'm also getting the 'Mark not set' error using a minimal config:

call plug#begin('~/.vim/pluggedtest')
Plug 'rescript-lang/vim-rescript'

call plug#end()

The errors don't seem to have anything to do with the contents of the .res files I'm loading.

I'm happy to debug and put up a PR if you can point me in the right direction.

Highlighting bug when having template string literals

I experience some issues with syntax highlighting whenever I browse some bigger template string codeblocks, mixed with normal ReScript code:

%%bs.raw(
  `
function PromiseBox(p) {
    this.nested = p;
};
function unbox(value) {
    if (value instanceof PromiseBox)
        return value.nested;
    else
        return value;
}
function box(value) {
    if (value != null && typeof value.then === 'function')
        return new PromiseBox(value);
    else
        return value;
}
function make(executor) {
    return new Promise(function (resolve, reject) {
        var boxingResolve = function(value) {
            resolve(box(value));
        };
        executor(boxingResolve, reject);
    });
};
function resolved(value) {
    return Promise.resolve(box(value));
};
function then(promise, callback) {
    return promise.then(function (value) {
        try {
            return callback(unbox(value));
        }
        catch (exception) {
            onUnhandledException.contents(exception);
        }
    });
};
function catch_(promise, callback) {
    var safeCallback = function (error) {
        try {
            return callback(error);
        }
        catch (exception) {
            onUnhandledException.contents(exception);
        }
    };
    return promise.catch(safeCallback);
};
`
)

type result<'a, 'e> = Belt.Result.t<'a, 'e> = Ok('a) | Error('e)

module Js_ = {
  type t<'a, 'e> = rejectable<'a, 'e>

  external relax: promise<'a> => rejectable<'a, _> = "%identity"

  @bs.val
  external jsNew: (('a => unit, 'e => unit) => unit) => rejectable<'a, 'e> = "make"

  let pending = () => {
    let resolve = ref(ignore)
    let reject = ref(ignore)
    let p = jsNew((resolve', reject') => {
      resolve := resolve'
      reject := reject'
    })
    (p, resolve.contents, reject.contents)
  }

  @bs.val
  external resolved: 'a => rejectable<'a, _> = "resolved"

  @bs.val
  external flatMap: (rejectable<'a, 'e>, 'a => rejectable<'b, 'e>) => rejectable<'b, 'e> = "then"

  let map = (promise, callback) => flatMap(promise, v => resolved(callback(v)))

  let get = (promise, callback) => ignore(map(promise, callback))

  let tap = (promise, callback) => {
    get(promise, callback)
    promise
  }

  @bs.scope("Promise") @bs.val
  external rejected: 'e => rejectable<_, 'e> = "reject"

  @bs.val
  external catch: (rejectable<'a, 'e>, 'e => rejectable<'a, 'e2>) => rejectable<'a, 'e2> = "catch_"

  @bs.val
  external unbox: 'a => 'a = "unbox"

  @bs.scope("Promise") @bs.val
  external jsAll: 'a => 'b = "all"

  let allArray = promises => map(jsAll(promises), promises => Belt.Array.map(promises, unbox))

  let all = promises => map(allArray(Belt.List.toArray(promises)), Belt.List.fromArray)

  let all2 = (p1, p2) => jsAll((p1, p2))

  let all3 = (p1, p2, p3) => jsAll((p1, p2, p3))

  let all4 = (p1, p2, p3, p4) => jsAll((p1, p2, p3, p4))

  let all5 = (p1, p2, p3, p4, p5) => jsAll((p1, p2, p3, p4, p5))

  let all6 = (p1, p2, p3, p4, p5, p6) => jsAll((p1, p2, p3, p4, p5, p6))

  @bs.scope("Promise") @bs.val
  external jsRace: array<rejectable<'a, 'e>> => rejectable<'a, 'e> = "race"

  let race = promises =>
    if promises == list{} {
      raise(Invalid_argument("Promise.race([]) would be pending forever"))
    } else {
      jsRace(Belt.List.toArray(promises))
    }

  let toResult = promise => catch(map(promise, v => Ok(v)), e => resolved(Error(e)))

  let fromResult = promise => flatMap(relax(promise), x =>
      switch x {
      | Ok(v) => resolved(v)
      | Error(e) => rejected(e)
      }
    )

  external fromJsPromise: Js.Promise.t<'a> => rejectable<'a, Js.Promise.error> = "%identity"

  external toJsPromise: rejectable<'a, _> => Js.Promise.t<'a> = "%identity"
}

As soon as I navigate to the beginning of the Js_ module, the highlighting bugs out and marks all the rest of my current view buffer as a string:

image

Notice how the content of the template string gets highlighted as regular ReScript code, while the code outside of the template string is highlighted as a string.

This behavior is sometimes hard to reproduce. Sometimes i just j,h,k,l navigate to a point where this behavior gets triggered, sometimes the reformatter triggers a rerender of the syntax highlighting.

Oftentimes :e! or inserting a line in the current code position temporarily fixes the problem. It's really annoying though.

coc -> Rename doesn't work across files

There's an issue where a coc-rename over multiple files fails with [coc.nvim] Error on applyEdits: Cannot read property 'uri' of null

To reproduce, create the following files:

// MyFile1.res

let a = 1
// MyFile2.res

let b = MyFile1.a

Then try to coc-rename MyFile1.a to MyFile1.something, and it will first ask to load 1 file from disk, and then fail with the error message mentioned above.

My wild guess is that it's an issue with how coc interprets the rename command result. Either our LSP is not sticking to certain protocol conventions, or coc-vim is at fault. Hard to debug.

Omni completion duplicate prefix

When I select an entry from the omni completion menu, the existing prefix is duplicated. I'm using the latest vim-rescript and the suggested omni completion configuration (without coc-vim).

The problem can be demonstrated (once issue #56 has been fixed) by first creating an empty .res file, compiling the project, opening the file in VIM or Neovim and then typing out the following:

Js.Un

Hit <C-x><C-o> in insert mode with the cursor at the end of the line. The only match (Undefined) will be selected as expected. Afterwards the buffer will look like this:

Js.UnUndefined

The plugin most probably shouldn't end up duplicating the common prefix.

It looks like VS Code does the right thing by default and "will replace the word until the cursor with the given label or insertText" in cases like this:

https://code.visualstudio.com/api/references/vscode-api#CompletionItem

This might be a bit problematic to fix client side, because it looks like the plugin must know the correct location when the completion function is first called (when findstart is set to 1). Could the bulk of the logic be moved there so that the second invocation would just return the already-populated list?

Or could the analysis binary be amended to include insertText?

Add errorformat

Since the commands like :RescriptBuild were removed, it would be very useful if this included support for Vim's built-in makeprg and errorformat features. I assume makeprg can just be npx rescript $*, but I'm not skilled enough at using errorformat to know what it needs to be.

Highlight escaped backticks in a interpolation string correctly

Given following code:

let a = "abc"


let str = "aaa\"bbb"

Js.log(` \` ccc ${a} ddd  `)


Js.log(`a = ${a}`)

Js.log(``)

let b = 34

let parser = %raw(`
  
adsfadsfzz
`)

Will break the syntax highlighting:

image

We fixed this in rescript-vscode with a negative lookbehind that also matches escaped backticks, but we couldn't get it to work for vim yet.

@amiralies any idea how to solve this? Would be even greater to highlight the escaped backtick in a different color, like in common strings.

Vim LSP Support

Hello,

It would be helpful if there was some sort of documentation on how to get this to work with native vim-lsp.

Nvim Treesitter support

Not sure if I should post it here, but the tree-sitter build-in neovim doesn't support rescript. It's a great improvement for color highlight and other plugins features ( I think about blankline or telescope preview for example).
With the recent release of nvim 0.5, it's now a must have.

If we look at the elm way, they have a dedicated repo: https://github.com/elm-tooling/tree-sitter-elm for the "regular" tree-sitter as a common based, then we can have the slightly different version targeting nvim as explain here: nvim-treesitter/nvim-treesitter#529

Posting it here, as vs code took the opposite way to deprecied tree-sitter so it primaly focus neovim. Also, the current highlight syntax have some issue, it can fixed it at least for neovim, in what it seems to be an easier way than through LSP.

I will probably not have time to take care of it, but I post it here for the record anymway.

Omni completion for items without documentation

Under the hood, rescript-editor-analysis.exe returns null instead of an object/dict when a completion item has no documentation. This results in multiple errors in rescript#Complete.

A minimal example with vim-plug and the latest versions of vim-rescript and rescript (tested in VIM 8.2 and in Neovim 0.6.1):

~/.vimrc or ~/.config/nvim/init.vim:

call plug#begin()
Plug 'rescript-lang/vim-rescript'
call plug#end()

set omnifunc=rescript#Complete
set completeopt+=preview

Example.res:

let myInteger = 1
let myString = "2"

Also needed:

  • complete/completion mismatch fix: #56

Make sure the project is built. Type let my as the last line of Example.res and hit <C-x><C-o> in insert mode. You'll get the following errors twice:

Error detected while processing function rescript#Complete:
line   36:
E121: Undefined variable: value
Press ENTER or type command to continue
Error detected while processing function rescript#Complete:
line   38:
E121: Undefined variable: entry
Press ENTER or type command to continue
Error detected while processing function rescript#Complete:
line   38:
E116: Invalid arguments for function add(l:ret, entry)
Press ENTER or type command to continue

After hitting ENTER enough times:

-- Omni completion (^O^N^P) Pattern not found

I think the problem lies here:

let entry = { 'word': item.label, 'kind': l:kind, 'info': item.documentation.value }

item.documentation is null for undocumented matches.

I tried to replace the offending line with the following, and now omni completion works both for built-in items and for undocumented local items (but I'm no expert in vimscript, so this may be a silly way to do it):

    if type(item.documentation) == v:t_dict
      let l:info = item.documentation.value
    else
      let l:info = item.detail " or some default value
    endif

    let entry = { 'word': item.label, 'kind': l:kind, 'info': l:info }

Proper highlighting for polyvars

Following polyvar cases should be uniformly highlighted:

  • #normal
  • #"exotic"
  • #\"old-exotic"

Right now, exotic polyvars are wrongly detected, # being color-less, while the value is interpreted as a string.

Language server crashes in COC

When I open a .res file, COC warns:

[coc.nvim] The "languageserver.rescript" server crashed 5 times in the last 3 minutes. The server will not be restarted.

Checking :CocInfo:

## Log of coc.nvim

2020-11-27T09:03:20.036 INFO (pid:81471) [services] - registered service "languageserver.rescript"
2020-11-27T09:03:20.058 INFO (pid:81471) [services] - registered service "diagnostic-languageserver"
2020-11-27T09:03:20.286 INFO (pid:81471) [services] - registered service "reason"
2020-11-27T09:03:20.306 INFO (pid:81471) [plugin] - coc.nvim 0.0.79-3658eda4fa initialized with node: v15.2.1 after 347ms
2020-11-27T09:03:20.313 INFO (pid:81471) [watchman] - watchman watching project: /Users/dfalling/Code/ido
2020-11-27T09:03:23.183 INFO (pid:81471) [services] - rescript state change: stopped => starting
2020-11-27T09:03:23.193 INFO (pid:81471) [language-client-index] - languageserver.rescript started with 82051
2020-11-27T09:03:23.245 INFO (pid:81471) [services] - rescript state change: starting => stopped
2020-11-27T09:03:23.246 INFO (pid:81471) [services] - rescript state change: stopped => starting
2020-11-27T09:03:23.249 INFO (pid:81471) [language-client-index] - languageserver.rescript started with 82053
2020-11-27T09:03:23.297 INFO (pid:81471) [services] - rescript state change: starting => stopped
2020-11-27T09:03:23.297 INFO (pid:81471) [services] - rescript state change: stopped => starting
2020-11-27T09:03:23.300 INFO (pid:81471) [language-client-index] - languageserver.rescript started with 82054
2020-11-27T09:03:23.350 INFO (pid:81471) [services] - rescript state change: starting => stopped
2020-11-27T09:03:23.350 INFO (pid:81471) [services] - rescript state change: stopped => starting
2020-11-27T09:03:23.354 INFO (pid:81471) [language-client-index] - languageserver.rescript started with 82055
2020-11-27T09:03:23.402 INFO (pid:81471) [services] - rescript state change: starting => stopped
2020-11-27T09:03:23.402 INFO (pid:81471) [services] - rescript state change: stopped => starting
2020-11-27T09:03:23.405 INFO (pid:81471) [language-client-index] - languageserver.rescript started with 82056
2020-11-27T09:03:23.455 INFO (pid:81471) [services] - rescript state change: starting => stopped

And :RescriptInfo

ReScript version: 8.3.3
Detected Config File: bsconfig.json
Detected Project Root: /Users/dfalling/Code/ido
Detected rescript_editor_support_exe: /Users/dfalling/.config/nvim/plugged/vim-rescript/rescript-vscode-1.0.0/extension
/server/darwin/rescript-editor-support.exe
Detected rescript_compile_exenode_modules/bs-platform/darwin/bsc.exe
Detected rescript_build_exenode_modules/bs-platform/darwin/bsb.exe

I've configured COC exactly as specified in the README.md. Any suggestions on troubleshooting this?

Thanks!

Stop changing directory

d2e9a90 causes undesired effect with other plugins like fzf, nerd tree etc that depends on the current directory.

I am working on a big monorepo that also have other code besides Rescript.

- mono-repo
  - not_rescript_project_A
  - not_rescript_project_B
  - rescript_project
    - bs.config.js
    - package.json
  - ....
  - not_rescript_project_Z
  - .git

Then,

cd mono_repo/rescript_project
vim .

I expect :pwd to print mono_repo/rescript_project but since the plugin changes the directory, it prints mono_repo.

Trying to use fzf is now impossible because it tries to search everything under mono_repo instead of just mono_repo/rescript_project. I can fix it by doing :cd rescript_project but still that is troublesome. Is there a way to disable this?

avoid 1 <enter> when opening new file

Whenever I open a nvim session on a *.res file, it asks me to press "1 "

Start a build on this project to get the freshest data ?
1. start build

Is there a way to have this auto-yes so I do not have to hit 1 <cr> every time I open a nvim session ?

Thanks!

Incorrect resource paths

For some reason, on my setup, the following code results in the wrong paths:

let g:rescript_bsc_exe = getcwd() . "/" . l:res_bin_dir . "/bsc.exe"
let g:rescript_bsb_exe = getcwd() . "/" . l:res_bin_dir . "/bsb.exe"

The path l:res_bin_dir is already absolute, so prepending getcwd() adds redundant directories to the front and makes the path wrong.

This change fixes the paths on my system: ellbur@b42b94e

I don't know much about vimscript so I don't know if that would cause problems on other systems.

My system is: Linux (Manjaro), NeoVim 0.6.1.

Update of LSP-server

Hello,

I'm using this plugin for several months now. Actually the server version is quite outdated.

Locally I just replaced the server folder with newer ones from the vscode plugin. First v 1.3.0, now 1.4.0.

tldr: when will this plugin be updated? Are there plans to update it automatically?

I could create a PR if simply changing the server folder is enough. But after reading an older commit, there were more changes like new commands etc. So it would probably take a bit more time.

Cheers,
Daniel

ctags / tags integration for listing the outline

A common VIM workflow is to create tags file (often via ctags). There is no ReScript / ctags language extension, but maybe this is not even needed.

In a first version it would be perfectly fine to comply to the ctags file format and use the editor-support binary to retrieve the data for our modules.

When rescript-vscode supports outlines, it would also be possible to use that functionality to list outlines via coc-vim of course. I want to have a vanilla vim version first though.

Also check out how to use tags / how to create tag files in vim.

Create interface files

As this plugin is for neovim AND vim, I don't know, how to manage it.
So maybe just for everyones interest, I created a function (for neovim) to automatically create resi files:

function createInterfaceFile()
    local path = vim.api.nvim_buf_get_name(0)

    if vim.fn.filereadable(path .. "i") == 1 then
        print("Interface file already exists")
    else
        -- print("Create interface file")

        vim.lsp.buf_request(
          0, 
          "textDocument/createInterface", 
          { uri = "file://" .. path }, 
          function ()
            print("Interface file created")
          end
        )
    end
end

vim.cmd("command RescriptCreateInterfaceFile lua createInterfaceFile()")

Testing for RC 2.1.0

Hey @amiralies, could you check out the latest master and test if coc-rename works for you?
Added the newest LSP impl and want to make sure it works on someone else's machine this time.

Anyone else here, feel free to test as well!

Support for Monorepos via Yarn Workspaces

Looks like the format will not work since the binary is only stored top level in the project under the global node_modules directory.

I understand this is a bit tricky or odd since each sub module can use a different version of bs-platform, but I am wondering if there is a way to traverse up until the node_modules/bs-platform is found, and at the point, use the latest version?

Highlight improvements

  1. Extension points: %raw, %%raw, %re
  2. Top level Attribute: @@attribute
  3. Ternary: ? and :
  4. Highlight list in list{...} as Function
  5. Highlight [, ], { and }
%raw("payload")
%%raw("payload")
let r = %re("/b/g")
@@warning("-27")
let a = b ? c : e
let a = list{1, 2, 3}
let arr = [1, 2, 3]

image

Neovim LSP seems broken ?

Hey, I use this plugin with native LSP on neovim. It used to work fine, when I open a project, it ask me if I want to compile stuff, I enter 1 and here we go ! It compile at each save. But since 2/3 days, probably after an update or something, it doesn't work anymore.

:LspInfo:

Configured servers: lua, typescript, go, json, css, svelte, efm, vue, rescriptls
Neovim logs at: /home/equinox/.cache/nvim/lsp.log

2 client(s) attached to this buffer: efm, rescriptls

  Client: efm (id: 1 pid: 7655)
  	root:      /home/equinox/Programming/opo/pupil/pupil-core
  	filetypes: 
  	cmd:       /home/equinox/.local/share/nvim/lspinstall/efm/./efm-langserver
  	autostart: True

  Client: rescriptls (id: 2 pid: 7656)
  	root:      /home/equinox/Programming/opo/pupil/pupil-core
  	filetypes: rescript
  	cmd:       node /home/equinox/.local/share/nvim/site/pack/paqs/start/vim-rescript/server/out/server.js --stdio
  	autostart: True

2 active client(s): 

  Client: efm (id: 1 pid: 7655)
  	root:      /home/equinox/Programming/opo/pupil/pupil-core
  	filetypes: 
  	cmd:       /home/equinox/.local/share/nvim/lspinstall/efm/./efm-langserver
  	autostart: True

  Client: rescriptls (id: 2 pid: 7656)
  	root:      /home/equinox/Programming/opo/pupil/pupil-core
  	filetypes: rescript
  	cmd:       node /home/equinox/.local/share/nvim/site/pack/paqs/start/vim-rescript/server/out/server.js --stdio
  	autostart: True

Clients that match the filetype rescript:

Config: efm
	filetype: No filetypes defined, please define filetypes in setup().
  
  Config: rescriptls
  	cmd:               node /home/equinox/.local/share/nvim/site/pack/paqs/start/vim-rescript/server/out/server.js --stdio
  	cmd is executable: True
  	identified root:   /home/equinox/Programming/opo/pupil/pupil-core
  	autostart:         True
  	custom handlers:   
❯ nvim -v
NVIM v0.5.0
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim/src/neovim-0.5.0/build/config -I/build/neovim/src/neovim-0.5.0/src -I/usr/include -I/build/neovim/src/neovim-0.5.0/build/src/nvim/auto -I/build/neovim/src/neovim-0.5.0/build/include
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

LSP config:

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.resolveSupport = {
  properties = {
    'documentation',
    'detail',
    'additionalTextEdits',
  }
}

lspconfig.rescriptls.setup{
  capabilities = capabilities,
    cmd = {'node', '/home/equinox/.local/share/nvim/site/pack/paqs/start/vim-rescript/server/out/server.js' ,'--stdio'},
   on_attach = function()
        lsp_signature.on_attach()
    end
}

Add support for commenting

Neovim v10 has a built-in commenting support based on the treesitter. But rescript files can not be commented, and failing with the following error:

Option 'commentstring' is empty.

add rescript support to vim-polyglot

https://github.com/sheerun/vim-polyglot is a popular repo for getting all languages support (so that you don't install each lsp individually)

should this be added to the list to make it simpler for newcomers to have rescript syntax support out of the box, without even installing any new plugins

for example reason config:
https://github.com/sheerun/vim-polyglot/blob/ce31cd1d2f4e8eee9fd91325e4599f15cb9566fd/packages.yaml#L1390-L1394

and ocaml:
https://github.com/sheerun/vim-polyglot/blob/ce31cd1d2f4e8eee9fd91325e4599f15cb9566fd/packages.yaml#L1105-L1117

TypeHint and JumpToDefinition not working after 2.0.1 update

I currently get errors for :RescriptTypeHint and :RescriptJumpToDefinition. (Format and build commands work fine.) I cloned https://github.com/rescript-lang/rescript-project-template which uses rescript 9.1.2 to make sure it wasn't something specific in my project. Opening the demo file there:

For :RescriptTypeHint, I get Type Info failed with exit code '1'
For :RescriptJumpToDefinition, I get Analysis binary failed with exit code '1'

I normally use COC, which also doesn't work as expected, but figured it's related to the regular commands not working.

I installed the latest version of vim-rescript with plug. Just in case, I completely uninstalled it and reinstalled it. Going into my /plugged/vim-rescript/ folder I confirmed it's at latest version.

Previously I was using bs-platform 9.0.2 and an older of vim-rescript and it worked great. Just in case I also tried installing bs-platform in this project template repo I'm testing with but it has the same issue. I also have another linux machine that I went through the same steps with but that also had the same issue.

Here is my :RescriptInfo. If there is a way I can get more helpful errors above, or if I can try anything else to help debug, please let me know.

ReScript version: 9.1.2
Editor mode: modern (using rescript.exe instead of bsc / bsb)
Detected Config File: /potato/playground/rescript-project-template/bsconfig.json
Detected Project Root: /potato/playground/rescript-project-template
Detected rescript_analysis_exe: /root/.vim/plugged/vim-rescript/server/analysis_binaries/linux/rescript-editor-analysis.exe
Detected rescript_exe: /potato/playground/rescript-project-template/node_modules/rescript/linux/rescript.exe
Detected (legacy) rescript_bsc_exe: /potato/playground/rescript-project-template/node_modules/rescript/linux/bsc.exe
Bundled rescript server version: 1.1.1

E20: Mark not set with :e

I did a PlugUpdate and now I'm getting this every time I run :e to reload the current file.

Error detected while processing BufRead Autocommands for "*.res":
E20: Mark not set

I've disabled all other plugins and it occurs with nothing but vim-rescript installed.

I'm on regular vim 8.2.950

Rescript 9.1.1 update needed

I'm playing with the Rescript 9.1.1 beta and getting a "Cannot find a nearby node_modules/bs-platform/darwin/bsc.exe. It's needed for formatting." error. I assume this is because the binaries have been moving around.

printing to echo message on enter?

Hey there, I'm not sure whether this is some issue with my editor or that of the plugin, but every time I press enter or hit o in normal mode, the last line get printed to the status line. Any ideas, Thanks

node_modules are not located correctly

For some reason finddir returns the full path on my system so getCwd() . finddir() causes the path to be /Users/user/path/to/project//Users/user/path/to/project/node_modules/.... I had to remove getCwd() calls from rescript#UpdateProjectEnv() and it all works. It's probably something about my setup but I cannot figure it out.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.