Code Monkey home page Code Monkey logo

Comments (8)

pgourlain avatar pgourlain commented on September 13, 2024

Hi Tan,

Can you provide "drop.erl", in order to reproduce it on my laptop.

thanks.

from vscode_erlang.

tan-wei avatar tan-wei commented on September 13, 2024

No problem. The code here is from book Introducing Erlang published by O'Reilly:

-module(drop).

-export([fall_velocity/2]).

fall_velocity(Planemo, Distance) when Distance >= 0 ->
    case Planemo of
        earth ->
            math:sqrt(2 * 9.8 * Distance);
        moon ->
            math:sqrt(2 * 1.6 * Distance);
        mars ->
            math:sqrt(2 * 3.71 * Distance)  % no closing period!
    end.

Quite an easy code with rebar.config in the project:

{plugins, [rebar3_format]}.

I'm quite new in Erlang, so maybe there is something wrong with my project settings. But I can't find further information in the repo, so I open an issue here to ask whether is my own problem.

Thanks for such a great project and quick reply.

from vscode_erlang.

tan-wei avatar tan-wei commented on September 13, 2024

Manual command works with formatter now:

rebar3 format --files ./drop.erl

from vscode_erlang.

wojteksurowka avatar wojteksurowka commented on September 13, 2024

Fixed by #224

from vscode_erlang.

tan-wei avatar tan-wei commented on September 13, 2024

Thanks. Waiting for the PR is merged.

from vscode_erlang.

tan-wei avatar tan-wei commented on September 13, 2024

I can confirm that the issue should be closed. Thanks!

from vscode_erlang.

tan-wei avatar tan-wei commented on September 13, 2024

A strange phenomenon. I create a new file records.hrl which comes from book Introducing Erlang:

-record(planemo, {name, gravity, diameter, distance_from_sun}).
-record(tower, {location, height=20, planemo=earth, name}).

After I save with formatting it, the file becomes empty. It seems elfmt clear it all. But if I use manual command:

rebar3 format --files ./records.hrl

It will correctly format the file (see spaces around =):

-record(planemo, {name, gravity, diameter, distance_from_sun}).
-record(tower, {location, height = 20, planemo = earth, name}).

Is it special case for elfmt to process *.hrl files?

from vscode_erlang.

tan-wei avatar tan-wei commented on September 13, 2024

Solved. Thanks!

from vscode_erlang.

Related Issues (20)

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.