Git Product home page Git Product logo

vim-better-sml's People

Contributors

anthonycalandra avatar dangkhoasdc avatar huxpro avatar jez avatar lcd047 avatar wchargin 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

vim-better-sml's Issues

Adjust indent level for nested case expressions

It'd be nice if the indent level was context-sensitive, to the extent that Vim
syntax regex can make it. In particular, we we could solve the following edge
case. Consider the following snippet of SML:

datatype ord = Z | S of ord | Sup of (int -> ord)

fun toString n =
  case n
    of Z => "0"
     | S n' =>
         (case n'
            of Z => "1"
             | S _ => "1 < n < aleph"
             | _ => "malformed")
     | Sup f => ">= aleph"

Try copying this into Vim right now; the last line isn't indented properly.
Right now, the indent file indents lines like the last line under the most
recent case keyword, ignoring any nesting structure.

After thinking about how to do it, I'm confident that it's possible, but I don't
quite have the attention to devote to it right now. For posterity's sake, here's
what I think a potential strategy would be.

The core of the work would be reworking the default syntax/sml.vim file. We'd
add in a bunch of syntax highlighting regions; more than currently exist
there. We'd be matching things like let .. in .. end regions and parenthesized
regions. Then, in the indent expression defined in indent/sml.vim (of this
repo, now, not the default Vim one), we'd use synIDattr(), synstack(), and
related functions to look up the syntax highlighted group under the cursor and
indent appropriately. If we have the entire stack of highlighting regions under
the cursor, we can look up how many groups we just left in going from one line
to the next, and decrease the indent appropriately.

So all in all, very possible, just a bit of work.

SMLReplStart with 'use' requires incorrect filename

Suppose I'm editing the file test.sml and decide to launch REPL. I call :SMLReplStart and it works but does this:

val _ = use "SMLNJ";
val _ = use "SMLNJ";
Standard ML of New Jersey v110.85 [built: Thu Dec 27 20:00:48 2018]
- [opening SMLNJ]
[use failed: Io: openIn failed on "SMLNJ", No such file or directory]
-

I think the problem is in bettersml#repl#ReplUse(). expand('%') evaluates to "SMLNJ" because it is the name of the opened buffer which contains the REPL. There has to be a way to find out the name of the buffer that invoked the REPL, so that we do use "test.sml";. It should also happen only once, I don't know why it seems to require "SMLNJ" twice.

I'm using neovim 0.3.2 and don't have anything special in my init.vim. Healthcheck results:

health#bettersml#check
========================================================================
## REPL
  - OK: REPL backend is available and valid: neovim
  - OK: SML/NJ is executable at '/usr/bin/smlnj'.
  - OK: rlwrap is available and will be used to launch REPLs

## Type information
  - OK: MLton is executable at 'mlton'.
  - OK: Support files are executable at '/home/interpreter/.vim/plugged/vim-better-sml/bin/vbs-util'.

## General
  - OK: Asynchronous jobs are available.
  - WARNING: def-use files will not be auto-built
    - ADVICE:
      - We did not find an MLBasis file for your project, and you have
      - g:sml_auto_create_def_use = 'mlb'. This means that def-use files
      - will only be auto-built for multi-file projects.
      - See :help |g:sml_auto_create_def_use| for more information.
  - OK: Either ALE or Syntastic is installed.

Unable to find mlb file

Many thanks for this excellent plugin. Just started using this after coming to neovim (having been an emacs user for all of my life!).

Everything works very well so far, except that def-use doesn't appear to be working, although I do have an mlb file setup correctly, and I can manually run mlton to generate the du file.

image

As we can see, the plugin is unable to find the mlb file. The directory contains two files:

hello.sml
prog.mlb

prog.mlb contains the following

local
  $(SML_LIB)/basis/basis.mlb
in
  hello.sml
end

And the following works correctly:

mlton -prefer-abs-paths true -show-def-use prog.du -stop tc prog.mlb

OS: Mac OS 14.3.1.
NVIM: v0.9.5

Any thoughts on what could be going wrong?

Error running make

I'm looking forward to using this, but I get the following error when running the first step from the makefile.

$ mlton -show-def-use support/def-use-util.du -prefer-abs-paths true support/def-use-util.mlb
Warning: /home/nacnudus/.config/nvim/plugged/vim-better-sml/support/unused-defs.sml 19.11.
  Declaration is not exhaustive.
    missing pattern: (:: (_, (:: (_, (:: (_, nil))))))
		   | (:: (_, (:: (_, nil)))) | (:: (_, nil)) | nil
    in: idType :: id :: filename :: linec  ...  ens Char.isSpace def
/usr/bin/ld: /usr/lib/mlton/targets/self/libmlton.a(platform.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/mlton/targets/self/libmlton.a(gc.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/mlton/targets/self/libmlton.a(bug.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/mlton/targets/self/libmlton.a(Stat.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/mlton/targets/self/libmlton.a(util.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/mlton/targets/self/libmlton.a(linux.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/mlton/targets/self/libgdtoa.a(strtof.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/mlton/targets/self/libgdtoa.a(strtodg.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/mlton/targets/self/libgdtoa.a(hexnan.o): relocation R_X86_64_32S against hidden symbol `hexdig_D2A' can not be used when making a shared object
/usr/bin/ld: /usr/lib/mlton/targets/self/libgdtoa.a(misc.o): relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/mlton/targets/self/libgdtoa.a(gethex.o): relocation R_X86_64_32S against hidden symbol `hexdig_D2A' can not be used when making a shared object
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
call to system failed with exit status 1:
gcc -o support/def-use-util /tmp/file2d9bX5.o /tmp/fileYGneUE.o /tmp/fileR5nUKO.o -L/usr/lib/mlton/targets/self -lmlton -lgdtoa -lm -lgmp -m64 -Wl,-znoexecstack
make: *** [Makefile:6: support/def-use-util] Error 1

Weird REPL output

Screenshot 2020-08-04 at 11 45 43
Hi ! When I open the repl, the output is weird: does not go to the next line when it should and puts some tabs when it shouldn't, does anyone know how to fix this? If I add semicolons to the source code everything is fine except it does not show me the hidden values anymore : (
Screenshot 2020-08-04 at 11 49 59
Thanks in advance : )

Ability to configure which CM file is loaded

This is a great plugin! If one improvement were possible, I think I might be able to use it in my projects.

The problem is that largescale SML developments typically have a number of different CM files, and usually it is only correct for the IDE to try and load a specific one of those; indeed, sometimes we may even design a CM file specifically for the IDE to use (to the exclusion of all others!).

In particular, if you are using path anchors in a CM files, the plugin may cause syntastic to load a CM file that has an unbound anchor, rather than the master CM file that sets this anchor.

In the SML mode for VS Code, we allowed users to have a little configuration file at their project root which explains to the IDE which CM file it should use. I don't know if you want something like that here, but something that achieves the same goal would be really useful.

Customize Indent layers

If I write a function with an if expression such as

fun f [] = 0
    | f (l::L) =
    if ...

the if defaults to being under the bar rather than the function name. Is there a way to change this?

Format code

Is there a way to add support to format the code? (indentation errors and such)

HealthCheck OK but none of REPL, TypeQuery and Concealing works

screen shot 2018-09-06 at 10 07 55 pm

Health Check

screen shot 2018-09-06 at 10 07 08 pm

Type Query (I'm new to SML so I was just using auto_gen = 'always' and try with a single file, I do see *.du* get generated under the same dir.

screen shot 2018-09-06 at 10 07 29 pm

Hmm no idea what happened. It does look like a syntax error from somewhere.

screen shot 2018-09-06 at 10 11 14 pm

concealing

screen shot 2018-09-06 at 10 11 51 pm

my .vimrc for vimbettersml (basically copy from README)

I wasn't sure what I did wrong, but thanks for the plugin in advance!

Add async checking support

We already support Syntastic checkers for

  • CM files with SML/NJ
  • unused variables with MLton def-use information

It would be great to integrate these checkers with ALE and/or Neomake for asynchronous checking.

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.