Giter Site home page Giter Site logo

anheuermann / metamodelica-language-vscode Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 1.31 MB

Extension for Visual Studio Code that adds language support for MetaModelica and Susan

Home Page: https://marketplace.visualstudio.com/items?itemName=AnHeuermann.metamodelica

License: MIT License

Dockerfile 1.38% Shell 3.99% Modelica 94.63%

metamodelica-language-vscode's People

Contributors

anheuermann avatar dependabot[bot] avatar lochel avatar phannebohm avatar simplydanny avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

phannebohm

metamodelica-language-vscode's Issues

Enumeration type definition not parsed correctly

Enumeration type definition containing strings not parsed correctly:

type PortFlowDirection = enumeration(Entering "Fluid flow is only entering", Leaving "Fluid flow is only leaving", Bidirectional "No restrictions on fluid flow (flow reversal possible)") "Enumeration to define whether flow reversal is allowed";

grafik

Multi-line docstring MetaModelica breaking highlighting

public function createFMISimulationFlags
  "Function reads FMI simulation flags from user input --fmiFlags
   and creates FmiSimulationFlags record for code generation.
   Author: AnHeuermann"
  input Boolean printWarning = true;
  output Option<SimCode.FmiSimulationFlags> fmiSimulationFlags;
// [...]
end createFMISimulationFlags;

grafik

Documentation string of classes not detected correctly after newline

The documentation string "Documentation" is only recognized when no newline is between it and the end of model M:

grafik

It's possible to use a begin and end rule key to find the model M and end M; parts. Then a way to catch the first string in between is needed to tell, that it is a documentation string.

Add Base Modelica support

Base Modelica (described in MCP 0031 draft) isn't highlighted yet.

It shouldn't be too hard to add highlighting for it. It's a subset of Modelica and files (at least from OpenModelica) start with //! base and have the file extension .mo.

baseModelica.mo

//! base 0.1.0
package 'A'
  record 'R1.R2'
    Real 'x';
  end 'R1.R2';

  model 'M'
    'R1.R2' 'r' = 'R1.R2'(1.0);
  end 'M';
end 'A';

or not highlighted in metamodelica

or is not highlighted as keyword in the following mwe:

  if inPosition < 0 or inPosition > listLength(inList) then
    print("function split ERROR:\n");
    print("Out of bounds error for input argument inPosition: " + intString(inPosition) + "\n");
  end if;

grafik

Correctly detect Modelica or MetaModelica language from '.mo' files.

Description

When opening .mo files correctly identify if it is a Modelica or a MetaModelica file. Default to Modelica if it can't be decided.

Examples

model M
end M;

Detect modelica since MetaModelica doesn't has keyword model.

uniontype Real
end Real;

Detect metamodelica since uniontype is not a Modelica keyword.

Highlight annotations

Annotations have general allowed values as well as vendor annotations. Highlight at least some of them as keywords.

package Modelica
  package Units
      function from_bar "Convert from bar to Pascal"
        extends Modelica.Units.Icons.Conversion;
        annotation(Inline = true);
      end from_bar;
    end Conversions;
  end Units;
  annotation(version = "4.0.0", versionDate = "2020-06-04", dateModified = "2020-06-04 11:00:00Z");
end Modelica;

model DrumBoiler_total  "Complete drum boiler model, including evaporator and supplementary components"
  extends Modelica.Fluid.Examples.DrumBoiler.DrumBoiler;
  annotation(experiment(StopTime = 5400));
end DrumBoiler_total;

grafik

Enumeration MetaModelica with docstring

Issue

type FunctionStatus = enumeration(
  BUILTIN    "A builtin function.",
  INITIAL    "The initial status.",
  EVALUATED  "Constants in the function has been evaluated by EvalConstants.",
  SIMPLIFIED "The function has been simplified by SimplifyModel.",
  COLLECTED  "The function has been added to the function tree."
);

Screenshot from 2024-03-14 10-05-24

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.