Giter VIP home page Giter VIP logo

csharpextensions's People

Stargazers

 avatar  avatar

csharpextensions's Issues

New action provider for struct

Struct could be readonly, record or readonly record.
Since the template covers the base case of struct, it would be nice to easily convert a struct into one of the above cases.

Create C# components using custom templates

Based on this request, the extension should be able to support custom templates.
The user should be able to define the sections which wants to customize, then using the menu item will be able to choose the template - from a list of templates - and then insert the name.

Tasks

  • template definition
  • template selection
  • template bundling

Get rid of *.tmpl files and use Custom Template logic.

Introducing the custom templates has shown how templates files are not needed and they can be specified in a more generic structure: Preset. Preset has a base content template which can be shared over the actual templates.

Upgrade dev dependencies

Remove deprecated dependencies:

  • vscode-test

Update

  • vsce -> @vscode/vsce

Upgrade

  • @types/vscode
  • @vscode/electron

Improve Custom Template with Attribute definition with placeholders

Some templates require add some attributes to class definition with placeholders

For example database migration template:

using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;

namespace TestProject.Migrations;

[DbContext(typeof(AppDbContext))]
[Migration("m231108_204500_CreateTestTable")]
public class m231108_204500_CreateTestTable: Migration
{
    protected override void Up(MigrationBuilder migrationBuilder)
    {
        migrationBuilder.CreateTable(
        name: "Test",
        columns: t => new
        {
            Id = t.Column<int>(type: "serial"),
        }
        ).PrimaryKey("PK-Test", c => c.Id);
    }
}

I need option to add attributes DbContext and Migration to class definition.
Also attribute Migration must contain class name as his parameter.

Implementation example:

Add new parameter attribute (or other name) to template definition with placeholder replacer.
Example:

"csharpextensions.templates": {
    "items": [
        {
           ...
            "construct": "class",
            "attribute": "[DbContext(typeof(AppDbContext))]\n[Migration(\"{{ ClassName }}\")]"                
        }
    ]
},

Improve Custom Template with Generics definition and generics where clauses

Introduce two specific sections which covers generics:

  • genericsDefinition: defines the keys used inside the generic. The keys will be specified inside a string separated by commas.
    genericsDefinition: "I,J,K". The keys should be enclosed automatically between < and >.
  • genericsWhereClauses: defines one or more generic where clauses. It's an array of string which the constraint of the related generic key. genericsWhereClauses: ["where I : class", "where J : struct", "where K : IMyInterface"]. The clauses will be joined by EOL and applied to the custom template.

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.