Skip to content
This repository has been archived by the owner on Jul 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #89 from mika-f/feature/vscode-extension
Browse files Browse the repository at this point in the history
  • Loading branch information
mika-f authored May 4, 2021
2 parents c6126f8 + 1f1bc17 commit acc0931
Show file tree
Hide file tree
Showing 28 changed files with 2,174 additions and 10 deletions.
54 changes: 51 additions & 3 deletions .github/workflows/automatic-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,61 @@ jobs:

- uses: actions/upload-artifact@v2
with:
name: UdonRabbit.Analyzer.Vsix.vsix
path: Source/UdonRabbit.Analyzer.Vsix/bin/Release/**/UdonRabbit.Analyzer.Vsix.vsix
name: UdonRabbit.Analyzer.VisualStudio.vsix
path: Source/UdonRabbit.Analyzer.VisualStudio/bin/Release/**/UdonRabbit.Analyzer.VisualStudio.vsix

# - name: Publish the package to Releases
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# files: Source/UdonRabbit.Analyzer.Vsix/bin/Release/**/UdonRabbit.Analyzer.Vsix.vsix
# files: Source/UdonRabbit.Analyzer.VisualStudio/bin/Release/**/UdonRabbit.Analyzer.VisualStudio.vsix
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

automatic-release-for-vsc:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
lfs: true

- uses: actions/setup-dotnet@v1
with:
dotnet-version: "5.0.x"
source-url: "https://nuget.pkg.github.com/mika-f/index.json"
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-node@v2
with:
node-version: "14"

- name: Build the project (VS)
run: dotnet build --configuration Release Source/UdonRabbit.Analyzer.Package/

- name: Build the project (TSC)
working-directory: Source/UdonRabbit.Analyzer.VisualStudioCode
run: |
yarn install
yarn run compile
cp ../UdonRabbit.Analyzer.Package/bin/Release/netstandard2.0/UdonRabbit.Analyzer.CodeFixes.dll ./externals/UdonRabbit.Analyzer.CodeFixes.dll
cp ../UdonRabbit.Analyzer.Package/bin/Release/netstandard2.0/UdonRabbit.Analyzer.dll ./externals/UdonRabbit.Analyzer.dll
- name: Packaging for VS Code
working-directory: Source/UdonRabbit.Analyzer.VisualStudio
run: |
yarn global add vsce
vsce package
- uses: actions/upload-artifact@v2
with:
name: UdonRabbit.Analyzer.VSCode.nupkg
path: Source/UdonRabbit.Analyzer.VisualStudioCode/*.vsix

# - name: Publish the package to Releases
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# files: Source/UdonRabbit.Analyzer.Package/bin/Release/*.nupkg
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<RootNamespace>UdonRabbit.Analyzer.Vsix</RootNamespace>
<AssemblyName>UdonRabbit.Analyzer.Vsix</AssemblyName>
<RootNamespace>UdonRabbit.Analyzer.VisualStudio</RootNamespace>
<AssemblyName>UdonRabbit.Analyzer.VisualStudio</AssemblyName>
</PropertyGroup>

<PropertyGroup>
Expand Down
22 changes: 22 additions & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"**/*.d.ts"
]
}
3 changes: 3 additions & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.dll
*.vsix
out/
3 changes: 3 additions & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 180
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
34 changes: 34 additions & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
11 changes: 11 additions & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
20 changes: 20 additions & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
11 changes: 11 additions & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.vscode/**
.vscode-test/**
out/test/**
src/**
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
1 change: 1 addition & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/.yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--ignore-engines true
9 changes: 9 additions & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "udonrabbit-analyzer" extension will be documented in this file.

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

## [Unreleased]

- Initial release
56 changes: 56 additions & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# UdonRabbit.Analyzer for Visual Studio Code

Experimental .NET Roslyn Analyzer for VRChat Udon and UdonSharp.
This analyzer accelerates your Udon development with UdonSharp.
Check out the [list of analyzers](https://github.com/mika-f/UdonRabbit.Analyzer/tree/master/docs/analyzers) defined in this project.
Not enough types of analyzers in UdonRabbit.Analyzer?
You can check out the [list of missing analyzers](https://github.com/mika-f/UdonRabbit.Analyzer/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Aenhancement) or create a new issues.

## Features

- It reports the part of the behaviour that doesn't work well on VRChat as an error in editor
- It reports an error in the editor that about the syntax that cannot be compiled by the UdonSharp
- etc

## Requirements

- Microsoft Visual Studio 2019 or IDE that supports Roslyn Analyzer
- VRCSDK3 that supports Udon
- UdonSharp

## Analyzer Documents

See https://docs.mochizuki.moe/udon-rabbit/analayzer/analyzers/

## ScreenShots

<img src="https://user-images.githubusercontent.com/10832834/112584755-c8528d00-8e3b-11eb-9204-1c05c0669ffc.PNG" width="500px" />

## Troubleshooting

### I found a bug on VS/VS Code/Rider/Analyzer

If you find a bug, feel free to create a new issue!

### Analyzer is not worked on UdonSharpBehaviour

You cannot run multiple UdonRabbit.Analyzer instances in the same Unity workspace.
Therefore, if you are running Analyzer in multiple editors, disable one.
If that doesn't work, we recommend restarting your PC.

## License

MIT by [@6jz](https://twitter.com/6jz)

## Third Party Notices

This project contains some code from the following project.
See method comments for details.

- [MerlinVR/UdonSharp](https://github.com/MerlinVR/UdonSharp)
- [Microsoft/Microsoft.Unity.Analyzers](https://github.com/microsoft/Microsoft.Unity.Analyzers)

## Links

Discord Server : https://discord.gg/h42BzsFtD2
Patreon : XXX
Empty file.
65 changes: 65 additions & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "udonrabbit-analyzer",
"publisher": "natsuneko",
"displayName": "UdonRabbit Analyzer",
"description": "The Roslyn Analyzer for VRChat Udon and UdonSharp.",
"version": "0.11.4",
"engines": {
"vscode": "^1.55.0"
},
"categories": [
"Other"
],
"activationEvents": [
"*"
],
"main": "./out/extension.js",
"files": [
"out",
"externals"
],
"license": "MIT",
"homepage": "https://github.com/mika-f/UdonRabbit.Analyzer",
"repository": {
"type": "git",
"url": "https://github.com/mika-f/UdonRabbit.Analyzer.git"
},
"contributes": {
"configuration": {
"title": "UdonRabbit Analyzer",
"properties": {
"udonrabbit-analyzer.rewriteOmniSharpJson": {
"type": "boolean",
"default": true,
"description": "Automatically rewrite omnisharp.json file in workspace or global."
}
}
}
},
"scripts": {
"vscode:prepublish": "yarn run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "yarn run compile && yarn run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
"@types/glob": "^7.1.3",
"@types/mocha": "^8.0.4",
"@types/node": "^12.11.7",
"@types/vscode": "^1.55.0",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"eslint": "^7.19.0",
"eslint-config-prettier": "^8.1.0",
"glob": "^7.1.6",
"mocha": "^8.2.1",
"prettier": "^2.2.1",
"typescript": "^4.1.3",
"vscode-test": "^1.5.0"
},
"dependencies": {
"json5": "^2.2.0"
}
}
22 changes: 22 additions & 0 deletions Source/UdonRabbit.Analyzer.VisualStudioCode/src/extension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from "vscode";

import { configureExtensionPath, writeConfiguration } from "./omnisharp";
import { onChangeWorkspace } from "./workspace";

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
const shouldRewriteOmniSharp = vscode.workspace.getConfiguration("udonrabbit-analyzer").get<boolean>("rewriteOmniSharpJson");

if (shouldRewriteOmniSharp) {
configureExtensionPath(context.extensionPath);
writeConfiguration();

context.subscriptions.push(vscode.workspace.onDidChangeWorkspaceFolders((e) => onChangeWorkspace(e)));
}
}

// this method is called when your extension is deactivated
export function deactivate() {}
Loading

0 comments on commit acc0931

Please sign in to comment.