Giter VIP home page Giter VIP logo

rescript-vscode's People

Contributors

a-c-sreedhar-reddy avatar aaronz0 avatar ah-yu avatar amiralies avatar an-tu avatar arden144 avatar aspeddro avatar bluehotdog avatar brnrdog avatar chenglou avatar cknitt avatar cristianoc avatar dependabot[bot] avatar dzakh avatar fhammerschmidt avatar illbexyz avatar iwankaramazow avatar jaredly avatar jfrolich avatar jjlee avatar marcoemrich avatar minnozz avatar mununki avatar ryyppy avatar smorimoto avatar tsnobip avatar wangbinyq avatar whythat avatar woeps avatar zth 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rescript-vscode's Issues

Errors don't change on editing the file

Errors only show up when loading vscode for the first time. Consequent editing of the file doesn't seem to update the diagnostic info.

On opening vscode

part-2020_12_01_16_47_55

On fixing the issue (expecting it to show the next error which is unused params)

part-2020_12_01_16_48_12

on windows, the error diagnostics does not work

Js.log ("hel")

let a = 1 + 2

let u = [1,2]

let v = u + 3

The problem panel is empty.

lib/bs/.compiler.log is correct

#Start(595963434)


  We've found a bug for you!

  C:\Users\hongbozhang\git\hello\src\demo.res:10:9

  

   8 │ let u = [1,2]

   9 │ 

  10 │ let v = u + 3

  11 │ 

  

  This has type: array<int>

  Somewhere wanted: int

  

#Done(595964572)

Format width option

Please add an option for configuring the format width (like Reason Language Server had with reason_language_server.format_width).

Line breaks in documentation comments aren't formatted when displayed

Version 1.0.2 on macOS.

It seems documentation written with @ocaml.doc() doesn't format properly when shown in VSCode. This example code:

@ocaml.doc(`This is a comment that's supposed to show up when hovering the value below. Hover this binding inside of DocIssues.res.

Note that line breaks are displayed as \n rather than as an actual line break when hovering.

## That fact seems to...
...break some of the markdown capabilities too.
`)
let getTestInt = () => 123

...gives this result:
image

Notice that line breaks are printed as-is rather than as line breaks. Unsure whether this is the main issue/only issue. However, when broken line breaks do not interfere, markdown formatting etc seems to work just fine.

Seeing the mentioned Promise-related error after starting the extension from vscode

I'm getting this error in a popup, after about 7s after clicking the button:

Error processing attach: Error: Could not connect to debug target at http://localhost:6009: Promise was canceled
	at e (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:1:103397)
	at async t (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:59:47354)
	at async P.launch (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:1:126302)
	at async t.Binder.captureLaunch (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:59:127629)
	at async t.Binder._launch (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:59:127180)
	at async Promise.all (index 5)
	at async t.Binder._boot (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:59:126440)
	at async t.default._onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:1:110922)

The extension development host window does open and stay open.

Feature request: Syntax highlight improvement

Hi, seems like moving to this extension from Reasonml introduces much worse experience in syntax highlighting. (less things are highlighted, and in general it looks "less")
Before i go ahead and try to improve it, is someone working on this?
(last time i tried to improve something my work got turned down since someone already worked on it, dont want to waste my time again)

Feature request: autocomplete record members on construction, and variants when pattern matching

This is a feature request/idea that I'm sure you're already well aware of, but I'll go ahead and add it here anyway. Two things that I think would greatly enhance the experience of using ReScript day-to-day is:

  1. Completing record members when constructing records
  2. Completing variants when pattern matching

I've included a "repro"/examples of what I mean here: https://github.com/zth/rescript-editor-tooling-playground/blob/dd7dd23fd58270683e91dd6e57898e6e40e212d4/src/AutoComplete.res

I understand this is probably non-trivial. But, the type of "exploratory" autocompletion it enables is something that I think is one of the absolute best aspects of the editor integration of for example TypeScript.

Support for OCaml/ReasonML syntax?

👋

Thanks for making this project! With all of the tooling surrounding ReScript/ReasonML/OCaml being very hard to use, it would be nice if this package could work on all of the supported syntaxes. That would make the IDE/tooling experience much nicer.

No hover on labelled arguments

Using 1.0.4 on macOS.

Hovering on labelled arguments does not produce any results. Here's an example in code:

type cfg = {content: string}

let someFunction = (
  ~process: string => string,
  ~anotherSubFunction: cfg => string,
  content: string,
) => {
  anotherSubFunction({content: content->process})
}

// Hovering `process` or `anotherSubFunction` here gives no results. I'd expect `string => string` and `cfg => string` (ideally with `cfg` expanded in the hover too).
let x = someFunction(~process=s => s, ~anotherSubFunction=({content}) => content, "hello")

A repro is available in code here: https://github.com/zth/rescript-editor-tooling-playground/blob/master/src/FunctionHoverIssues.res

Feature Request: Add Folding Region markers

This is a feature request to add folding regions to .res files:
Folding Regions
According to VSCode docs:

To have region markers configured for your language, contact the language extension provider.

It would be a really helpful feature to organise larger files.

Feature request: support autocomplete

I'm not sure if it's a problem with my setup or something that hasn't been implemented yet but it would be great to have some sort of autocomplete. I don't see it on the feature list so I'm assuming it's not there yet. I'm only starting to look at rescript so it's very possible that I've missed something too. Thanks very much!

Support for showing the fully ppx code for a file

reason-vscode has quite useful Show the fully ppx code for this file command that shows what the ppx result would look for that file. Is it possible to replicate this functionality in Rescript extension?

image

Hitting format without saving the file, doesn't update diagnostics

Modified a buffer with the following contents:

let serverFunction = (. req, res) => {
  Js.log(req.path)
  switch req.path {
    | "/stylesheet.css" =>
      let markup = ReactDOMServer.renderToStaticMarkup(<Hello />)

  res.send(. markup)
    | _ =>
  }

I was expecting to see a syntax error after hitting format, but nothing happened

Outline is not showing

The outline is not working when I focus on a .res file.
image

it does work when I use a .re

Without this, it is hard to navigate long files.

Edit
Another benefit of the Outline is that you can search symbols with Cmd-shift-o

in this screenshot shows the spotlight to search symbols, although in Rescript files is currently not working.

image

Contribute schema for bsconfig.json

VS Code provides a contribution point for json schemas. Using this would avoid the need for a $schema property in the bsconfig.json (which currently is a bit broken, since the schema doesn't allow for a $schema property.....). All that would be necessary is the addition of

"jsonValidation": [
  {
    "fileMatch": ".jshintrc",
    "url": "https://json.schemastore.org/jshintrc"
  }
]

to the contributions.

Goto Definition for JSX

I'd like to propose a special "go-to-definition" for navigating JSX components.

Rationale

In the previous LSP it is really cumbersome to go to a definition for any JSX element.

It's very common (at least for me) to create components with a lot of submodule components. Whenever I follow a definition in some JSX using a parent component, I land at the beginning of the target module and I need to manually find the make function (which is tedious, since each submodule also implements a make function as well, so regex find is not a straightforward option)

Proposal

Given following example:

let a = <div>
  <MyComponent text="test"/>
</div>

I'd expect following behavior:

React JSX enabled

  • When I follow the definition of MyComponent, it should point to the @react.component make function, instead of the module definition
  • When I follow the definition of the text argument of MyComponent, it should point to the ~text argument in the make function

React JSX disabled

  • MyComponent should point to MyComponent.createElement
  • Arguments like text should point to the labeled argument text in let createElement = (~text,...)

Edge Cases

Nested JSX modules

<MyComponent.SubComponent> ... </MyComponent.SubComponent>

Definitions of MyComponent and SubComponent should be able to be followed separately, depending on what element was selected.

Components without @react.component

type props = {
  "text": string // The labeled argument is equivalent to this line 
};

let makeProps = ...

// Plain function (happens sometimes)
let make = (props) => {
  ...
}

Here we can't really point to labeled arguments, so when a labeled argument is navigated, I am not sure if it should point to the attribute within the props type, or the props argument within the make function itself. I guess the latter is easier, and good enough.

Formatting not working on Windows

When formatting on Windows I get this error:

[Error - 20:56:35] Request textDocument/formatting failed.
  Message: Cannot find a nearby node_modules\bs-platform\win32\bsc.exe. It's needed for formatting.
  Code: -32600 

I found the cause of the error in:

// TODO: remove this hack
let filePath = openFile.replace('file://', '');

because just removing the file:// prefix isn't enough in Windows. On my system filePath contains \c%3A\Users\Alberto\workspace\rescript-vscode\node_modules\bs-platform\win32\bsc.exe which isn't recognized by NodeJS's APIs.

Feature request: autocomplete/annotations for annotations(e.g @bs.module etc)

One of the hardest thing in ReScript is finding the right magic of annotations. i find myself always looking at other libs and examples. just because there's no logic to it and very little organization(it's all under bs namespace).
One thing that might REALLY help is allowing us to just type
@bs. and have a list of all supported annotations with a helping text as to how to use them, when, and alternatives.

I think this is super important, i know for myself i would be able to write better bindings if some love was invested in this area, and good bindings are sorely missing in the rescript ecosystem.

Awesome v1 release!!! super pumped at the new direction ReScript is going!

Highlighting of JSX tags

Hi,

I'm testing out the new 1.0 release of the plugin and I am very impressed! It might be already on the radar, but I didn't see an issue for it; the JSX tags are currently not highlighted making the source code harder to read IMO. See attached code sample for the difference:

image

Tailwind CSS IntelliSense compatibility

After migrating a few Reason files to the ReScript syntax, I noticed that the Tailwind CSS IntelliSense (e.g. autocomplete, linting, hover previews, syntax highlighting) provided via the Tailwind CSS VS Code extension does not appear to work for res files. I'm not certain as to whether this would be an issue with rescript-vscode or vscode-tailwindcss, but I figured I'd open an issue here to hopefully identify the issue origin. Thanks!

Reason Syntax ReScript Syntax
reason-autocomplete-available rescript-autocomplete-missing

Errors and Problems don't update from /lib/bs/compiler.log

this might be a duplicate of #34. I post it as a new issue since it has nothing to do with Angular or a specific project.

Description: VS Code does not update errors (or the lack of) from the complier-log. Neither Problem-View nor "red underlines".

Since this a very basic function, I suspect it has to do with my environment which is Node 14, Ubuntu 20.04 and VSCode 1.52. I used a new clean build of VSCode and only installed rescript-vscode 1.0.2.

Steps: See the the Video to reproduce

update_issue.mp4

Observations:

  • The Compiler-Log is always correct
  • Restarting VSCode updates the VSCode views, but it still does not update again

Thanks so much for all your hard work. Let me know, if I can do anything to help track down the issue. (I'm very dedicated, this is the only issue that prevents my team to switch to ReScript).

Exception thrown on Windows 10 /Mac OS and does not seem to work

Tested on Windows 10, Mac MacOS 10.13.6 High Sierra.

  • VSCode 1.51.1
  • rescript-vscode version 1.0.0
  • bs-platform version 8.3.3

When opening any res file the output of the language server throws an exception and nothing seems to work.

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\server\out\RescriptEditorSupport.js:89:31
    at ChildProcess.exithandler (child_process.js:295:7)
    at ChildProcess.emit (events.js:223:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
[Error - 23:47:10] Connection to server got closed. Server will not be restarted.
[Error - 23:47:10] Request textDocument/completion failed.
Error: Connection got disposed.
	at Object.dispose (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:904:25)
	at Object.dispose (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:74:35)
	at LanguageClient.handleConnectionClosed (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:2309:42)
	at LanguageClient.handleConnectionClosed (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-languageclient\lib\main.js:155:15)
	at closeHandler (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:2296:18)
	at CallbackList.invoke (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:62:39)
	at Emitter.fire (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:121:36)
	at closeHandler (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:240:26)
	at CallbackList.invoke (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:62:39)
	at Emitter.fire (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:121:36)
	at IPCMessageReader.fireClose (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:111:27)
	at ChildProcess.<anonymous> (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:213:45)
	at ChildProcess.emit (events.js:228:7)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

Very long error messages are cut off

I ran into a very annoying error message with ReasonReact where I had a typo in a prop (onKeypress instead of onKeyPress). The most valuable part of the error message is at the bottom and I couldn't see it.

Repro: https://rescript-lang.org/try?code=LYewJgrgNgpgBAIQgF2SAdnAvHA3gKDjgAEAnGAQwGNkA6KkYABwxnWULlmTmAoGt4OABQA-BhHYAuOAEt2ASmwA+PJyIAeAEYo0mDAGkYATybkAzuay5hAfSVZVwhQF9VuYOYDmAWmUAlShpac2RSeS8XOA0Aeh1UDGVOF3wUoA

module Button = {
  @react.component
  let make = (~count: int) => {
    <button onKeypress={(_) => ()}> {msg->React.string} </button>
  }
}

image

This problem has several facets:

  1. The extension doesn't show the full message
  2. This error message is massive, but I understand why the full tuple might be helpful in some situations
  3. The most helpful piece of information is on the last line

I'm primarily a TS dev so I'm used to reading error messages from bottom to top, but I don't think it makes for the best experience - especially when compared to Rust for example.

Doc strings not shown for modules/nested modules

Using 1.0.2 on macOS.

In short, the editor does not show me doc strings for modules or nested modules. I have this:

@ocaml.doc("This hover does not show up for the top level module.")
module Nested = {
  let x = "123"

  @ocaml.doc("...and neither does this hover")
  module NestedAgain = {
    let y = 123
  }
}

And hovering Nested or NestedAgain from another file (like SomeModule.Nested or SomeModule.Nested.NestedAgain) does not show the attached doc strings.

Here's a commit that details the issue: zth/rescript-editor-tooling-playground@5f484ba

Build does not start when coming from sleep

If VSCode is running with ReScript files already open when returning from sleep, the bsb build is not running and the "Start Build" dialog does not appear.

Expected: Modifying a ReScript file makes plugin to realize the build is not running and it pops the dialog

Workarouds:

  1. Close all files and reopen -> dialog shows
  2. Restart extension host

Platform: Ubuntu 18.04

Type diagnostics on hover are wrong

It seems like the type diagnostics on hover are assuming my mouse to be on top of a completely different expression.

In the following screenshot I am hovering over the addEventListener but the type diagnostics say that i am hovering over Belt.Option. (Which is 5 rows above and to the right of where I am actually hovering).

hover

`/tmp/lsp.log` doesn't work for a shared server

Currently, the language server crashes for me when I work on a remote server (via a Remote - SSH plugin), with the following message:

Error: Command failed: /home/sergey/.vscode-server/extensions/chenglou92.rescript-vscode-1.0.2/server/linux/rescript-editor-support.exe dump /home/sergey/monorepo/frontend/packages/product-calendar/src/components/PcLink.res:19:14
Fatal error: exception Sys_error("/tmp/lsp.log: Permission denied")

And this is because /tmp/lsp.log is created and owned by my teammate, not by me. Deleting the file resolves the problem.

But even if we figure out the file permissions, won't it mean that only one person at a time is able to work at one particular machine? That would be unfortunate because the server is meant to be used for development by many people at once.

Compilation errors should appear in the error panel in vscode

With ts, flow or reason-language-server, you can find compilation/types errors in the error panel of VScode, not just as inline errors in files.
This is very handy to quickly knows if you project is "ok & running well" or not, without having to check all files or console or browser/simulators (without even being sure it's "up to date").

Here is a project with a "Problem" with RLS.

image

Note bottom bar (on the left) where you have the counter of errors/warnings.

This is not the case with rescript-vscode 1.0.0. Would be nice to have support for this.

Syntax highlighting is not complete

Hey ✋

First of all, thank you everyone for your effort. Things have started to come together recently and I wanted to test how well this extension works. Looks like syntax highlighting is not complete. TextMate grammar file needs some more regexps/scopes to be able to deliver much "complete" highlighting experience. I'd like to contribute to this and I've even started 😄. I wonder If anyone working on this? If not, I'm gonna continue.

Also, semantic highlighting would be awesome! I'd like to contribute to that too but I haven't dig into the rescript-editor-support yet. I believe that is where the tokenization, type on hover process etc. occurs. Looks like we need that info to make semantic highlighting possible.

P.S: I have no experience in VSCode extension development, language servers etc. Just trying to help and learn new things.

Syntax highlighting of nested comments is broken

Hi,

Syntax highlighting of nested comments is broken:

/*
let foo = 1
/*
let bar = 1
*/
let baz = 1
*/

GitHub has the same problem, so the code block above is a good demonstration. The compiler seems to support nested comments.

Syntax Highlighting messes up with generic optional parameters

Taking an example from the documentation, this snippet:

let drawCircle: (~color: color, ~radius: int=?, unit) => unit =
  (~color: color, ~radius: option<int>=?, ()) => {
    setColor(color)
    switch radius {
    | None => startAt(1, 1)
    | Some(r_) => startAt(r_, r_)
    }
  }

highlights >= as an operator, rather than as a closing bracket for the generic and an equal sign. This happens in VS Code as well:
image
This is particularly problematic for those who use ligature fonts, as ligatures depend on proper coloring to break up things that look like ligatures but really aren't.
Is the tokenizer/grammar that colors this defined here, or in another repository?

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.