Giter VIP home page Giter VIP logo

vscode-extension's Introduction

Accord Project Extension for VS Code

Version number Installation count GitHub license Join the Accord Project Slack

The Accord Project extension helps developers to create, test and debug Accord Project templates.

For a step-by-step guide on getting started with the extension's features, access our VS Code Tutorial. For more comprehensive documentation, follow this link.

Accord Project Extension Homepage

Installation

Please visit the Visual Studio Code Marketplace for installation and more details.

Features

  • Create data models for templates using the Concerto modelling language
  • Develop the logic for templates using the Ergo domain specific language
  • Write the natural language text for templates using the CiceroMark extended markdown syntax
  • Run unit tests for templates using the Cucumber BDD testing framework
  • Trigger templates (send them data and view the results)
  • Syntax highlighting for all files
  • Compilation and problem markers
  • HTML preview for template markdown text and Concerto models

Commands

  • Compile your model.cto file to a target

Code Gen GIF

  • Draft clause after passing relevent input into the form.

Draft Clause GIF

  • Work offline by downloading Concerto model dependencies (context-click on a *.cto file)
  • Export PlantUML class diagram (context-click on a *.cto file)

Downdload Models and Export Class Diagrsms GIF

  • Parse Clause after entering relevent information into the input form.
  • Export the template directory as a .cta archive.

Parse Clause and Export as archive GIF

  • Trigger a template, parsing data from sample.md and passing in request.json and state.json (context-click on root folder)

Trigger Clause GIF

Views

  • HTML preview for template text (open grammar.tem.md and then press the Open Preview icon in the editor or context menu)
  • HTML preview for Concerto models (open *.cto and then press the Open Preview icon in the editor or context menu)

Quick Fixes

  • Add a variable to the template model if an undeclared variable is used in grammar.tem.md. Note that the model.cto file must be open for the quick fix to be available.

Concerto Snippets

The extention adds code snippets for the following elements of the Concerto language.

Element Prefix
Asset asset
Participant participant
Transaction transaction
Concept concept
Enum enum
Event event
Namespace namespace
Import import
String string
Double double
Integer int
Long long
DateTime date
Boolean bool

Ergo Snippets

The extention adds code snippets for the following elements of the Ergo language.

Element Prefix
Clause clause
Contract contract

Contact Us

If you have find any problems or want to make suggestions for future features please create issues and suggestions on Github. For any questions please join the Accord Project Discord community and post questions to the #technology-cicero channel.

Acknowledgments

Thanks to our friends at IBM Blockchain Platform for inspiring us with their existing plugin.


Accord Project Logo

GitHub license Join the Accord Project Slack

Accord Project is an open source, non-profit, initiative working to transform contract management and contract automation by digitizing contracts. Accord Project operates under the umbrella of the Linux Foundation. The technical charter for the Accord Project can be found here.

Learn More About Accord Project

Contributing

The Accord Project technology is being developed as open source. All the software packages are being actively maintained on GitHub and we encourage organizations and individuals to contribute requirements, documentation, issues, new templates, and code.

Find out what’s coming on our blog.

Join the Accord Project Technology Working Group Discord channel to get involved!

For code contributions, read our CONTRIBUTING guide and information for DEVELOPERS.

README Badge

Using Accord Project? Add a README badge to let everyone know: accord project

[![accord project](https://img.shields.io/badge/powered%20by-accord%20project-19C6C8.svg)](https://www.accordproject.org/)

License

Accord Project source code files are made available under the Apache License, Version 2.0. Accord Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0).

Copyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See LF Projects Trademark Policy.

vscode-extension's People

Contributors

akshitsarin avatar algomaster99 avatar ayman161803 avatar daniloff200 avatar dependabot[bot] avatar dselman avatar github-actions[bot] avatar irmerk avatar irohitsingh avatar jeromesimeon avatar michizhou avatar mttrbrts avatar parammittal16 avatar peterhunn avatar sidhyatikku avatar sstone1 avatar sumitkharche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-extension's Issues

Bug: Syntax markup gets messed up after a field with a name "type", followed by "optional" is used

Syntax markup gets messed up after a field with a name type, followed by optional is used.

Screenshot 2022-01-31 at 14 31 30

Expected Behavior

type and the below fields should be displayed constantly.

Current Behavior

type and the below fields are not displayed constantly.

Steps to Reproduce

Paste the following concept into the editor:

concept Foo {
  o String bar optional
  o String type optonal
  o String Baz optonal
}

Desktop

  • OS: macOS 12.1

Nice to have: Additional Cicero commands in command palette

Is your feature request related to a problem? Please describe.

Cicero provides the following commands via the CLI - parse, draft, normalize, trigger, invoke, initialize, archive, compile and get.

In VSCode Extension version 0.21.13, the trigger and archive commands are exposed via the command palette. It would be nice if some of the other Cicero CLI commands could be added too.

Describe the solution you'd like

For example,

  • parse - input /text/sample.md and generate a /text/data.json output file.
  • draft - input /text/data.json and generate a /text/sample.md output file.
    ...and similar for normalize, invoke, etc.

Maybe consider having a way to specify optional parameters if defaults not appropriate? E.g., an options.json file in, say, template root for optional parameters, such as --output, --wrapVariables, --unquoteVariables, --format etc.?)

{
   "parse":{
      "output":"./text/data.json",
      "currentTime":"null",
      "warnings":false,
      etc...etc...
   },
   "draft":{
      "output":"./text/sample.md",
      "wrapVariables":false,
      "unquoteVariables":false,
      etc...etc...
   },
   etc...etc...
}

Describe alternatives you've considered
Alternatively, keep using Cicero CLI, which works fine too! :-)

Typo in README

There are some grammatical issues in Readme file.
I want to correct them and work on this issue as of Hackoberfest.

Cannot run `Attach to server` debug option

Describe the bug
Whenever I try to run Attach to server debug option, it gives me this error
Screenshot_20200318_174238
I was following this guide to setup server and client of extension in debug mode in vscode.
https://code.visualstudio.com/api/language-extensions/language-server-extension-guide#debugging-both-client-and-server

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Run'
  2. Click on dropdown at the top and select Attach to server option
  3. See error

Desktop (please complete the following information):

  • OS: Kubuntu 18.04.3
  • VSCode Insiders 1.44

Inconsistent syntax highlighting for URLs

Describe the bug
The // in a URL is interpreted as a comment.

To Reproduce
Steps to reproduce the behavior:

  1. Open any model.cto file with cicero-vscode-extension enabled.
  2. Observe the highlight inconsistency in URLs.

Expected behavior
The colour of the highlighted URL should be uniform.

Screenshots
Screenshot from 2020-04-05 04-05-40

Desktop (please complete the following information):

  • OS: Ubuntu 18.04

VSCode CPU consumption rising at 100% after the installation of the extension

Describe the bug
When installed, CPU consumption of VSCode rises from <10% to 100%.

To Reproduce:

  1. Go to VS Code
  2. Install the extension while monitoring CPU comp.

Expected behavior
Normal CPU consumption

Desktop (please complete the following information):
cicero-vscode-extension 0.20.9 (current)
VS Code 1.43.0
Ubuntu 18.04.4 LTS

If it may help, here are my VSCode extensions list :
accordproject.cicero-vscode-extension
James-Yu.latex-workshop
JuanBlanco.solidity
ms-python.python
tomoki1207.pdf
wwm.better-align

Migrate CI/CD to GitHub Actions

As described in accordproject/technical-steering-committee#4

Please follow the conventions in accordproject/concerto#236

  • Remove secrets from Travis (for AP maintainers: in Travis Repository Settings)
  • Disable Travis in the configuration (for AP maintainers: Travis Personal Profile > Settings > Accord Project
  • Remove .travis.yml and .travis directories in repo
  • Add .github/workflows directory based on those in ./concerto/.github/workflows
  • Remove scripts in ./scripts replace by those found in ./concerto/scripts
  • Fix package.json notable adjustments: remove some of the old scripts, make sure code coverage works
  • Test build on PR with timestamps
  • Test build on GitHub release with version number

Inconsistent syntax highlighting

Describe the bug
Syntax highlighting is not consistent among type names.

To Reproduce
Steps to reproduce the behavior:

  1. Go to any .cto model, with the VSCode extension enabled.

Expected behavior
All type names should have consistent highlighting.

Screenshots
ss5
PaymentRequest is highlighted, but PayOut isn't.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser N/A
  • Version N/A

Outdated README.md

Discussion 🗣

The current README.md contains an invalid slack invite. The same can be replaced with an updated invite link to the discord server.

Would you like to work on this issue?

Yes

Missing entries in .gitignore

Describe the bug
.vscode and .dist folders are created by vscode and these folders contain user specific config for the IDE. These folders should be ignored by git so that no one accidentally commits these files.

Investigate VSCode in the browser with the Cicero Extension

There is a lot of new activity around supporting VSCode in the browser. It would be exciting to be able to be able to see if one of those projects would allow us to host a version of VSCode for editing Accord Project templates (with this extension).

Some notes from @DianaLease who has started investigating this.

VS Code in Browser

Things we'd like in an online app:

  • Ability to import/export
  • Ability to use AP extension
  • Ability to run cicero commands (?) - parse is built in to the extension (might need draft, trigger, etc)
  • Publish to github from editor (?) - should be easy to do with VS Code

Code-server: code-server/CONTRIBUTING.md at master · cdr/code-server · GitHub

Code Sandbox: CodeSandbox

  • This is using VS Code behind the scenes
  • "Initially we’ll support a predefined list of extensions, we’ll gradually open up the possibility for everyone to add and install their own extensions." (~ 1 year ago)
  • Can export as zip, but has some other stuff in it too

VS Code Online: Visual Studio Online - Cloud IDE - Code Editor Online

  • Needed to create an Azure account (I signed up for a free trial to try out)
  • In "public preview"
  • Can use latest AP extension
  • No way to export/import afaik. I supplied the github repo when creating the environment.
  • Terminal is read-only
  • Could running cicero parse, execute, etc be part of the plugin? (already have parse)
  • Could import/export be part of the plugin?

VS Code Remote Development (??)

StackBlitz: Similar to Code Sandbox, but not really what we want. More for creating UIs.

Highlighting acronyms

Describe the bug
Syntax highlighting issues when writing acronyms in VS Code

To Reproduce
Steps to reproduce the behavior:

  1. Go to VS Code
  2. Build a Concerto model with acronyms as enumerated types
  3. See lack of highlighting

Expected behavior
Acronyms should be highlighted in the same way as any other enumerated type

Screenshots
Screenshot 2019-09-16 13 41 02

Desktop (please complete the following information):
VS Code 3
MacOS

Adding Docs Regarding Snippets

Since I have added Snippets for Concerto Language and Snippets for Ergo Language is in progress. I want to add some documentation regarding how we can use it.

I started working on this.

Version numbers confusing

Any reason the version numbers shouldn't be aligned with the Cicero one? (at least the major/minor number?).

e.g., Cicero VSCode extension 0.13.* would be for Cicero 0.13.*

Implementing the Show Hover features

Hovers show information about the symbol/object that's below the mouse cursor.
Hovers can help to easily show the parsed errors or the description of the symbol/object.

I have already started working on this feature, and for now, it can display the word it's been hovered on and if there exists a parsing error.
Screen Shot 2020-03-18 at 11 46 00 PM

Error: EACCES: permission denied, mkdir 'log'

Describe the bug
After installing VSCode Extension receive following error, which is attempted five (5) times before VSCode gives up and stops trying to "restart the server".

Error: EACCES: permission denied, mkdir 'log'
at Object.mkdirSync (fs.js:731:3)
at setupLogger (/Users/martin/.vscode/extensions/accordproject.cicero-vscode-extension-0.13.0/server/node_modules/@accordproject/ergo-compiler/lib/logger.js:113:16)
at Object. (/Users/martin/.vscode/extensions/accordproject.cicero-vscode-extension-0.13.0/server/node_modules/@accordproject/ergo-compiler/lib/logger.js:125:1)
at Object. (/Users/martin/.vscode/extensions/accordproject.cicero-vscode-extension-0.13.0/server/node_modules/@accordproject/ergo-compiler/lib/logger.js:131:3)
at Module._compile (internal/modules/cjs/loader.js:693:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:704:10)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
[Error - 7:53:22 AM] Connection to server got closed. Server will not be restarted.

To Reproduce
Install Accord VS-Code Extension v0.13.0 onto clean (i.e. never previously installed) VS-Code

Expected behaviour
VSCode Extension still appears to function normally after error displayed. No obvious functional bugs or other errors.

Screenshots
Visual_Studio_Code

Desktop:
-- current installed Accord libraries are:
cicero v0.13.4
ergoc v0.9.4
-- OS: macOS Mojave v10.14.6
-- VS Code: August 2019 (version 1.38)

Add Create Template Feature

**Is your feature request related to a problem?
No

Describe the solution you'd like
I would like to suggest to add create template feature from the command pallette of vscode. This should create helloworld template in the selected folder and with selected project name. This will help end user to deal with the contracts on the go.

Additional context
Add any other context or screenshots about the feature request here.

Smart Editing for Ergo object creation expressions based on CTO models

Is your feature request related to a problem? Please describe.

Provide smart editing for Ergo object creation. The idea would be to be able to start writing the class e.g., Address{ and then the editor would provide a stub for the content of that class with default values.

Default values could be populated automatically, taking into account CTO defaults if present.

Additional context
This issue originated from user experience discussion and requirements for Ergo Init accordproject/ergo#734

Support for stand-alone Ergo or Concerto files

Running the extension on stand-alone Ergo or Concerto files introduces an infinite loop in search for the package.json file, due to which no error message is logged and the server essentially crashes
This can be traced back to the while-loop in the getTemplateRoot function in server.ts file

`function getTemplateRoot(pathStr, textDocument, diagnosticMap) {

let currentPath = pathStr;
connection.console.log(`Rikkic ${currentPath}`);

while(currentPath !== '.') {
    connection.console.log( `- ${currentPath}`);

    try {
        const packageJsonContents = getEditedFileContents(currentPath + '/package.json');
        const packageJson = JSON.parse(packageJsonContents);
        if(packageJson.accordproject) {
            return currentPath;
        }
    }
    catch(err) {
        connection.console.log( `- exception ${err}`);
        currentPath = path.normalize(path.join(currentPath, '..'));
    }
}

connection.console.log( `Failed to find template path for ${pathStr}`);
const error = {message: `${pathStr} is not a sub-folder of an Accord Project template. Ensure a parent folder contains a valid package.json.`};
pushDiagnostic(DiagnosticSeverity.Error, textDocument, error, 'template', diagnosticMap);
return null;

}
`

cicero command line model error when running in a windows powershell

When I run cicero parse or archive I get a model error every time. I upload the same code to Template Studio and if validates and I can create a CTA from template studio.

The error:
cicero archive --template rideshare-driver-requirements-service --archiveFile rideshare-driver-requirements-service
11:05:53 AM - error: Failed to find an asset that extends org.accordproject.cicero.contract.AccordClause in rideshare-driver-requirements-service. The model for the template must contain a single asset that extends org.accordproject.cicero.contract.AccordClause.

The model file:
namespace docusign.rideshare.requirements

import org.accordproject.cicero.contract.* from https://models.accordproject.org/cicero/contract.cto
import org.accordproject.cicero.runtime.* from https://models.accordproject.org/cicero/runtime.cto

transaction RideshareRequirementsServiceRequest extends Request {
o Boolean checkDriver
o String idNumber
o String insuranceCarrier
o String insuranceNumber
o Boolean overEighteen
o Boolean oneYearExperience
o Boolean validLicense
o Boolean twoAccidentsOrLess
o Boolean twoMovingViolationsOrLess
o Boolean zeroDistractedViolation
o Boolean zeroMajorViolations
o Boolean oneAccidentOneViolation
o Boolean validInsurance
}

transaction RideshareRequirementsServiceResponse extends Response {
o String validInsurance
o String validIdForRideShare
o String validLicense
o String oneAccidentOneViolationThreeYearsOrLess
o String twoAccidentsThreeYearsOrLess
o String twoViolationsThreeYearsOrLess
o String zeroDistractedViolationsThreeYears
o String zeroMajorViolationsFiveYears
o String validRequirements
o String valideRecord
}

asset RideshareRequirementsServiceClause extends AccordClause {
}

Adding Snippets for Ergo Language

This will provide users snippets for the ergo language. They don't have to write a template for every time they just have to type some keyword and they get a template for the class.

It is very similar to concerto issue #38.

I will soon land a pr for this feature :)

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.