Code Monkey home page Code Monkey logo

vscodehighlightformaple's Introduction

Maple support for Visual Studio Code

Syntaxes Highlight & Theme

The highlight theme Dark+ for maple is based on the vscode default Dark+ theme, added some color settings for the maple elements.

To change the theme, you can press ctrl+shift+P and search Theme, click Preference: Color Theme, and select the Maple Dark+ or Maple Light+.

If you don't like the color, you can change it in ./themes/maple_dark.json or ./themes/maple_light.json.

Support elements include:

  • line comment: #
  • block comment: (**)
  • keywords
  • string: surround with "", and handled escaping but ignore its correctness.
  • quoted names: surround with ``, and handled escaping but ignore its correctness.
  • unevaluated expressions: the '' can be used as () for expressions, so it's difficult to match these expressions, this extension just support mult-quoted unevaluated expressions such as 'x' and ''x'', expressions like ''x'+y' can not be highlighted correctly.
  • preprocessor: such as $include. Notice: In Maple, the introducer $ must appear as the first character of a line to be recognized as a preprocessor directive.
  • proc and module options. But deleted trace option, because it is rarely used, and can be instead of the trace function.
  • maple functions.
  • support extensions: mpl,mm,mi .

Proc/Module Outline

Support Maple proc/module outline:

  • support proc/module names like abc,abc or 'abc'.
  • support proc/module names in the form of :-name,name[anything],name[name2][name3],name:-name2:-name3.
  • do NOT support proc/module names in the form of name[[...]].
  • MUST use the grammer of proc() ... end proc or module() ... end module.
  • Compatible with older syntax, MUST end with ; or ;.
    • proc() ... end:
    • module() ... end:
    • do NOT use try ... end, use try ... end try instead.
    • do NOT use if ... end or do ... end

Snippets

Simple snippets including:

  • if
  • elif
  • else
  • proc
  • module
  • for
  • while
  • do
  • use
  • try
  • ifndef - define - endif

Maple Code Runner

Firstly, you should set the path of cmaple.exe.

"maple.cmaplePath":"${Maple Install Path}/bin/cmaple.exe"

And you can set the output option maple.isPrettyPrint to be true or false (default is false).

"maple.isPrettyPrint":true or false

Example for true

> solve(x^2+x-1);
                   1/2                 1/2
                  5                   5
                  ---- - 1/2, - 1/2 - ----
                   2                   2

Example for false

> solve(x^2+x-1);
1/2*5^(1/2)-1/2, -1/2-1/2*5^(1/2)

To run maple code, you can right click and select the Maple Runner menu. Or, you can press ctrl+shift+alt+m. While there is any code selected, it will run the selected code instead of run the whole file.

Notice:

  • it only support codes that can run in cmaple.exe.
  • every line should end with ; or :.
  • not support preprocessor commands.

vscodehighlightformaple's People

Contributors

yu961549745 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vscodehighlightformaple's Issues

Improved syntax highlighting

It appears the syntax highlighting doesn't work for library specific things like DifferentialGeometry specific functions. More syntax highlighting options like for operators and lists would be nice.

[Feature request] add stream output

首先感谢大佬开发的插件, 另外能不能加个实时输出的功能, 现在都是跑完所有代码才输出结果, 有时候代码运行很长时间就不能实时看到中间运行结果。

proc List

Hi Jiangtao,

Thanks for making such a useful extension for maple!

Since I keep long mpl files defining a lot of proc(), which is not easy to navigate. I am wondering if you could add the feature of a proc list to this vscode extension? I checked multiple editors that have extensions for Maple, but didn't find anyone with this feature. Thanks!

Highlighting for output

Another feature that would be really cool to see is syntax highlighting for the output panel.

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.