njpipeorgan / wolfram-language-notebook

Notebook support for Wolfram Language in VS Code
Apache License 2.0
159 stars 11 forks source link

add code-format #36

Closed asukaminato0721 closed 10 months ago

asukaminato0721 commented 1 year ago

Now it works well when kernel is connected and format one cell at a time.


Currently, function formatString is pending to be finished. I find https://github.com/WolframResearch/codeformatter may work, but couldn't figure out how to make this api.

Reference:

https://code.visualstudio.com/blogs/2016/11/15/formatters-best-practices#_the-formatting-api

asukaminato0721 commented 1 year ago

tmp lack of time, closed.

asukaminato0721 commented 1 year ago

current progress, I can see the result from logWrite

[Thu, 03 Aug 2023 00:03:12 GMT] Received the following data from kernel:
[Thu, 03 Aug 2023 00:03:12 GMT] Manipulate[
Block[{a=1.,n=8,θ=Pi/(2 n),e=Cos[θ],b=a Sin[θ]},
Graphics[{
Circle[{0,0},{a,b}],
Table[{If[Sin@#>Sin[θ],Circle[{-a Cos[θ] Cos[#],0},a Sin[θ] Sin[#]]]&/@
{2 i θ+t,t-2 (i-1) θ}},{i,n-1}]
},PlotRange->1.1a]
],{t,0,Pi/2}]
[Thu, 03 Aug 2023 00:03:12 GMT] Received the following data from kernel:
[Thu, 03 Aug 2023 00:03:12 GMT] Manipulate[
    Block[{a = 1., n = 8, θ = Pi / (2 n), e = Cos[θ], b = a Sin[θ]},
        Graphics[
            {
                Circle[{0, 0}, {a, b}]
                ,
                Table[
                    {
                        If[Sin @ # > Sin[θ],
                                Circle[{-a Cos[θ] Cos[#], 0}, a Sin[θ
                                    ] Sin[#]]
                            ]& /@ {2 i θ + t, t - 2 (i - 1) θ}
                    }
                    ,
                    {i, n - 1}
                ]
            }
            ,
            PlotRange -> 1.1 a
        ]
    ]
    ,
    {t, 0, Pi / 2}
]
[Thu, 03 Aug 2023 00:03:12 GMT] Failed to parse the following message:
[Thu, 03 Aug 2023 00:03:12 GMT] StringToByteArray[$Failed]
asukaminato0721 commented 1 year ago

https://github.com/njpipeorgan/wolfram-language-notebook/assets/30024051/55cc604b-a8d4-4fb1-aa3c-89a61a1a92c2

asukaminato0721 commented 10 months ago

https://github.com/asukaminato0721/mmafmt