Skip to content

Commit

Permalink
Merge pull request #2 from d1820/bug-fixes
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
d1820 authored Jan 19, 2024
2 parents c5d7c0f + 6b3e346 commit a697759
Show file tree
Hide file tree
Showing 13 changed files with 154 additions and 113 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@ dist
**/.vs/
**/bin
**/obj
pulltointerfacor-1.0.0.vsix
3 changes: 3 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.vscode/**
.vscode-test/**
src/**
.github/**
.gitignore
.yarnrc
vsc-extension-quickstart.md
Expand All @@ -9,3 +10,5 @@ vsc-extension-quickstart.md
**/*.map
**/*.ts
**/.vscode-test.*
**/Sample/**
**/GifInstruction/**
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ All notable changes to the "pulltointerfacor" extension will be documented in th

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]
## [1.0.0] 1.19.2024

- Initial release
- Initial release
Binary file added GifInstruction/PullToExample.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PullToInterfacor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 45 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,73 @@
# pulltointerfacor README
# PullToInterfacor

This is the README for your extension "pulltointerfacor". After writing up a brief description, we recommend including the following sections.

## Features

Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.

For example if there is an image subfolder under your extension project workspace:

\!\[feature X\]\(images/feature-x.png\)

> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
## Requirements

If you have any requirements or dependencies, add a section describing those and how to install and configure them.
---
![GitHub CI](https://github.com/d1820/PullToInterfacor/actions/workflows/node.js.yml/badge.svg)
![GitHub License](https://img.shields.io/github/license/d1820/PullToInterfacor?logo=github&logoColor=green)
![Visual Studio Marketplace Rating](https://img.shields.io/visual-studio-marketplace/stars/DanTurco.PullToInterfacor)
![Visual Studio Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/d/DanTurco.PullToInterfacor)
![Visual Studio Marketplace Version (including pre-releases)](https://img.shields.io/visual-studio-marketplace/v/DanTurco.PullToInterfacor)

## Extension Settings

Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
A Visual Studio Code Extension to include the ability to **Pull** methods and properties to inherited interfaces and base classes. This is targeted to C# development and is meant as a supplemental extension to C# Dev Kit. This extension supports pulling public properties and methods to interfaces, and public and protected methods to base classes.

For example:
## Installation
---

This extension contributes the following settings:
<!-- Download and install the VSIX from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=DanTurco.CodeDocumentor) -->

* `myExtension.enable`: Enable/disable this extension.
* `myExtension.thing`: Set to `blah` to do something.
## Table of Contents

## Known Issues
<!-- toc -->

Calling out known issues can help limit users opening duplicate issues against your extension.
- [PullToInterfacor](#pulltointerfacor)
- [Installation](#installation)
- [Table of Contents](#table-of-contents)
- [Instruction](#instruction)
- [Caveats](#caveats)
- [Known Issues](#known-issues)
- [Supported Members](#supported-members)
- [Interfaces](#interfaces)
- [Base Classes](#base-classes)
- [Usage Examples](#usage-examples)
- [Special Thanks](#special-thanks)

## Release Notes
<!-- tocstop -->

Users appreciate release notes as you update your extension.
## Instruction
---

### 1.0.0
1. Once installed successful to Visual Studio Code. You can access the commands from F1 then search for **Pull To**.

Initial release of ...
## Caveats

### 1.0.1
- This extension only works for base classes and interfaces that have their own C# file. Having multiple interfaces defined in 1 file will not work.
- Interface files must following the convention **I**Name. The I is the only way it knows its an interface with doing a bunch of file parsing and inference. To keep it fast I went with convention.
- This is a lot of file parsing to determine what to move, that said the easiest was to ensure all the using are present were to copy them all from the main class to the base or interface, and deduplicate the list. With C# Dev Kit installed the cleanup from that is quick to remove unused using.
- When pulling full backed property in this version we do not move the private backed field, so if using full backed property you will need to move that yourself. I am open to accepting PRs to update that functionality 😁

Fixed issue #.

### 1.1.0
## Known Issues

Added features X, Y, and Z.

---
## Supported Members

## Following extension guidelines
### Interfaces

Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.
- public properties
- public methods

* [Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines)
### Base Classes

## Working with Markdown
- public/protected properties
- public/protected methods

You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:

* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux).
* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets.
## Usage Examples

## For more information

* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)

**Enjoy!**
<img src="./GifInstruction/PullToExample.gif" />


https://github.com/devshop/csharp-model-to-builder
## Special Thanks
Some of the helpers were adopted from [devshop](https://github.com/devshop/csharp-model-to-builder)
13 changes: 12 additions & 1 deletion Sample/SampleProject/BaseClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ namespace Sample
{
public class BaseClass : IBaseClass
{

public string FullPropertyAlt
{
get
{
return _fullProperty;
}
set
{
_fullProperty = value;
}
}
public int MyProperty { get; set; }
}
}
1 change: 1 addition & 0 deletions Sample/SampleProject/IInternalTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using SampleProject;

namespace Sample
{
Expand Down
6 changes: 4 additions & 2 deletions Sample/SampleProject/IMyClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Test;
using SampleProject;

namespace Sample
{
public interface IMyClass
{
string FullPropertyAlt { get; set; }
async Task<int> GetNewIdAsync<TNewType>(string name,string address,string city,string state) where TNewType : class;
string FullProperty { get; set; }
}
}
18 changes: 1 addition & 17 deletions Sample/SampleProject/MyClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,35 @@ namespace Sample
public class MyClass<TType> : BaseClass, IMyClass, IMyTypedClass<string> where TType : class
{
private string _fullProperty;
public int MyProperty { get; set; }
public int MyPropertyLamda => 5;
public string FullProperty
{
get => _fullProperty;
set => _fullProperty = value;
}
public string FullPropertyAlt
{
get
{
return _fullProperty;
}
set
{
_fullProperty = value;
}
}
public async Task<int> GetNewIdAsync<TNewType>(string name,
string address,
string city,
string state) where TNewType : TType
string state) where TNewType : class
{
Console.WriteLine("starting");
var coll = new List<string>();
if (1 == 1)
{
foreach (var item in coll)
{

}
}
Console.WriteLine("ending");
return 1;
}

public Address MethodLambdaMultiLine() => new Address
{
Name = "",
City = "",
Street = ""
};

public int MyMethodLamda() => 5;

protected async Task<int> GetProtectedAsync<TNewType>(string name,
string address) where TNewType : class
{
Expand Down
21 changes: 18 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
{
"name": "pulltointerfacor",
"publisher": "DanTurco",
"displayName": "PullToInterfacor",
"description": "",
"version": "0.0.1",
"description": "A Visual Studio Code Extension to include the ability to **Pull** methods and properties to inherited interfaces and base classes. This is targeted to C# development and is meant as a supplemental extension to C# Dev Kit. This extension supports pulling public properties and methods to interfaces, and public and protected methods to base classes.",
"version": "1.0.0",
"engines": {
"vscode": "^1.85.0"
},
"repository": {
"url": "https://github.com/d1820/PullToInterfacor.git",
"type": "git"
},
"homepage": "https://github.com/d1820/PullToInterfacor/blob/main/README.md",
"icon": "./PullToInterfacor.png",
"galleryBanner": {
"color": "#2596be",
"theme": "light"
},
"bugs": {
"url": "https://github.com/d1820/PullToInterfacor/issues"
},
"categories": [
"Programming Languages",
"Other"
Expand Down Expand Up @@ -35,7 +49,8 @@
"test-jest": "jest",
"test-jest-watch": "jest --watch",
"test-jest-coverage": "jest --coverage",
"test:integration": "npm run compile && node ./node_modules/vscode/bin/test"
"test:integration": "npm run compile && node ./node_modules/vscode/bin/test",
"update-toc": "powershell -ExecutionPolicy Unrestricted markdown-toc ./README.md -i --bullets=\"-\" ; Write-Host \"Complete\""
},
"devDependencies": {
"@types/jest": "^25.2.3",
Expand Down
Loading

0 comments on commit a697759

Please sign in to comment.