コード例 #1
0
 public void InitializeTest()
 {
     _compilationUnit = new CompilationUnit();
     _compilation = new Compilation(new SourceAssembly("TestAssembly")
     {
         SourceFiles = { new SourceFile("dummy") { CompilationUnit = _compilationUnit } }
     })
     {
         Assemblies = { _mscorlibAssembly },
     };
 }
コード例 #2
0
 public void InitializeTest()
 {
     _compilationUnit = new CompilationUnit();
     _compilation = new Compilation(new SourceAssembly("TestAssembly")
     {
         SourceFiles = { new SourceFile("dummy") { CompilationUnit = _compilationUnit } }
     })
     {
         Assemblies = { _mscorlibAssembly },
     };
     _declaration = new MethodDeclaration("TestMethod", new PrimitiveTypeReference(PrimitiveType.Void));
     _declaration.Body = new BlockStatement();
     _compilationUnit.Types.Add(new TypeDeclaration("TestClass", TypeVariant.Class)
     {
         Members = { _declaration }
     });
 }
コード例 #3
0
        public static CodeSuggestionsList GetSuggestions(string source)
        {
            var offset = source.IndexOf('$');
            source = source.Replace("$", "");
            var document = new ReadOnlyDocument(source);
            var caretLocation = document.OffsetToLocation(offset);

            var file = new SourceFile("Program.cs")
            {
                CompilationUnit = CSharpLanguage.Instance.Parse(document)
            };

            var assembly = new SourceAssembly("TestAssembly")
            {
                SourceFiles = { file }
            };

            var compilation = new Compilation(assembly);
            compilation.Assemblies.Add(new NetAssembly(CorlibAssembly, typeof(object).Assembly.Location));

            var engine = new CSharpCompletionEngine(document, file);

            return new CodeSuggestionsList(engine.GetSuggestions(caretLocation).ToList());
        }
コード例 #4
0
ファイル: Compilation.cs プロジェクト: JerreS/AbstractCode
 public CompilationScope(Compilation compilation)
 {
     _compilation = compilation;
 }
コード例 #5
0
 public static void InitializeTestsClass(TestContext context)
 {
     _sourceAssembly = new SourceAssembly("TestAssembly");
     _compilation = new Compilation(_sourceAssembly);
     _compilation.Assemblies.Add(new NetAssembly(typeof(object).Assembly.Location));
 }