Skip to content

Instantly share code, notes, and snippets.

Avatar

Sebastien Lebreton sailro

View GitHub Profile
View demo.js
hookMonacoCompletionProvider(provider) {
const provideCompletionItems = provider.prototype.provideCompletionItems;
const owner = this;
provider.prototype.provideCompletionItems = async function (model, position, context, token) {
// reuse 'this' to preserve context through call (using apply)
const result = await provideCompletionItems.apply(this, [model, position, context, token]);
if (!result || !result.suggestions)
return result;
@sailro
sailro / Program.cs
Created Mar 3, 2020
Playing with Analyzers and Roslyn
View Program.cs
using Microsoft.CodeAnalysis;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Reflection;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Text;
@sailro
sailro / EditorScript.cs
Last active Dec 18, 2018
Remove 'latest'LangVersion added by Unity 2018.3 which is not supported by VS 2015
View EditorScript.cs
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEditor;
#if ENABLE_VSTU
using SyntaxTree.VisualStudio.Unity.Bridge;
View DebugSyntaxFactory.cs
using System;
using System.Linq;
using System.Reflection;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
namespace SyntaxTree.VisualStudio.Unity.Debugger.Evaluation
{
internal static class DebugSyntaxFactory
View EditorScript.cs
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEditor;
#if ENABLE_VSTU
using SyntaxTree.VisualStudio.Unity.Bridge;
View ProjectFileHook.cs
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEditor;
#if ENABLE_VSTU
using SyntaxTree.VisualStudio.Unity.Bridge;
@sailro
sailro / ProjectFileHook.cs
Last active May 22, 2018
Fix Unity project generation with .NET Standard
View ProjectFileHook.cs
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEditor;
#if ENABLE_VSTU
using SyntaxTree.VisualStudio.Unity.Bridge;
View llziplib.cs
var zip = ZipArchive.Read(filename);
foreach (var entry in zip.Entries)
{
entry.LocalFileHeader.Filename = entry.LocalFileHeader.Filename.Replace("\\", "/");
entry.CentralDirectoryHeader.Filename = entry.LocalFileHeader.Filename;
}
zip.Write(filename);
View clipboard.cs
var referencePoint = (ISourceLocation) InsertionPoints.SelectedItem;
var context = _languageService.CurrentContext;
var scope = UnityPackage.Settings.UnityMessageScope.ToScope();
var generateComment = GenerateComment.IsChecked.HasValue && GenerateComment.IsChecked.Value;
UnityPackage.DTE.UnderUndoContext("MonoBehaviour Wizard", () =>
{
foreach (CheckedMethodInfoItem node in MonoBehaviourTree.Items)
{
if (!node.IsChecked.HasValue || !node.IsChecked.Value)
View vstu.cs
[Test]
public void FloatingPointEvaluation()
{
/* If you create a custom algorithm that determines whether two floating-point
* numbers can be considered equal, you must use a value that is greater than
* the Epsilon constant to establish the acceptable absolute margin of difference
* for the two values to be considered equal. Typically, that margin of difference
* is many times greater than Epsilon. */
AssertExpressionsAtLine(13, "Fields.cs", new Evaluations
{