/// <summary> /// Initializes a new instance of the <see cref="CSharpCompletionContext"/> class. /// </summary> /// <param name="document">The document, make sure the FileName property is set on the document.</param> /// <param name="offset">The offset.</param> /// <param name="projectContent">Content of the project.</param> /// <param name="usings">The usings.</param> /// <param name="variables">The variables</param> /// <param name="namespace">The namespace.</param> public CSharpCompletionContext(IDocument document, int offset, IProjectContent projectContent, string usings = null, string variables = null, string @namespace = null) { OriginalDocument = document; OriginalOffset = offset; OriginalUsings = usings; OriginalVariables = variables; OriginalNamespace = @namespace; //if the document is a c# script we have to soround the document with some code. Document = PrepareCompletionDocument(document, ref offset, usings, variables, @namespace); Offset = offset; var syntaxTree = new CSharpParser().Parse(Document, Document.FileName); syntaxTree.Freeze(); var unresolvedFile = syntaxTree.ToTypeSystem(); ProjectContent = projectContent.AddOrUpdateFiles(unresolvedFile); //note: it's important that the project content is used that is returned after adding the unresolved file Compilation = ProjectContent.CreateCompilation(); var location = Document.GetLocation(Offset); Resolver = unresolvedFile.GetResolver(Compilation, location); TypeResolveContextAtCaret = unresolvedFile.GetTypeResolveContext(Compilation, location); CompletionContextProvider = new DefaultCompletionContextProvider(Document, unresolvedFile); }
public CSharpParameterCompletionEngine(IDocument document, ICompletionContextProvider completionContextProvider, IParameterCompletionDataFactory factory, IProjectContent content, CSharpTypeResolveContext ctx) : base (content, completionContextProvider, ctx) { if (document == null) { throw new ArgumentNullException("document"); } if (factory == null) { throw new ArgumentNullException("factory"); } this.document = document; this.factory = factory; }
private CSharpCompletionContext(ITextEditor editor, CSharpFullParseInformation parseInfo, ICompilation compilation, IProjectContent projectContent) { Debug.Assert(editor != null); Debug.Assert(parseInfo != null); Debug.Assert(compilation != null); Debug.Assert(projectContent != null); this.Editor = editor; this.ParseInformation = parseInfo; this.Compilation = compilation; this.ProjectContent = projectContent; this.TypeResolveContextAtCaret = parseInfo.UnresolvedFile.GetTypeResolveContext(compilation, editor.Caret.Location); this.CompletionContextProvider = new DefaultCompletionContextProvider(editor.Document, parseInfo.UnresolvedFile); }
public CSharpCodeCompletionContext(IDocument document, int offset, IProjectContent projectContent) { this.document = new ReadOnlyDocument(document, document.FileName); this.offset = offset; var unresolvedFile = CSharpParsingHelpers.CreateCSharpUnresolvedFile(this.document); this.projectContent = projectContent.AddOrUpdateFiles(unresolvedFile); completionContextProvider = new DefaultCompletionContextProvider(this.document, unresolvedFile); var compilation = this.projectContent.CreateCompilation(); var location = this.document.GetLocation(this.offset); typeResolveContextAtCaret = unresolvedFile.GetTypeResolveContext(compilation, location); }
protected CSharpCompletionEngineBase(IProjectContent content, ICompletionContextProvider completionContextProvider, CSharpTypeResolveContext ctx) { if (content == null) throw new ArgumentNullException("content"); if (ctx == null) throw new ArgumentNullException("ctx"); if (completionContextProvider == null) throw new ArgumentNullException("completionContextProvider"); this.ProjectContent = content; this.CompletionContextProvider = completionContextProvider; this.ctx = ctx; }
public CSharpParameterCompletionEngine(IDocument document, ICompletionContextProvider completionContextProvider, IParameterCompletionDataFactory factory, IProjectContent content, CSharpTypeResolveContext ctx) : base(content, completionContextProvider, ctx) { if (document == null) { throw new ArgumentNullException("document"); } if (factory == null) { throw new ArgumentNullException("factory"); } this.document = document; this.factory = factory; }
public CSharpCompletionEngine(IDocument document, ICompletionContextProvider completionContextProvider, ICompletionDataFactory factory, IProjectContent content, CSharpTypeResolveContext ctx) : base (content, completionContextProvider, ctx) { if (document == null) { throw new ArgumentNullException("document"); } if (factory == null) { throw new ArgumentNullException("factory"); } this.document = document; this.factory = factory; // Set defaults for additional input properties this.FormattingPolicy = FormattingOptionsFactory.CreateMono(); this.EolMarker = Environment.NewLine; this.IndentString = "\t"; }
private CSharpCompletionContext(ITextEditor editor, CSharpFullParseInformation parseInfo, ICompilation compilation, IProjectContent projectContent, IDocument document, TextLocation caretLocation) { Debug.Assert(editor != null); Debug.Assert(parseInfo != null); Debug.Assert(compilation != null); Debug.Assert(projectContent != null); Debug.Assert(document != null); this.Editor = editor; this.Document = document; this.ParseInformation = parseInfo; this.Compilation = compilation; this.ProjectContent = projectContent; this.TypeResolveContextAtCaret = parseInfo.UnresolvedFile.GetTypeResolveContext(compilation, caretLocation); this.CompletionContextProvider = new DefaultCompletionContextProvider(document, parseInfo.UnresolvedFile); }
public CSharpCodeCompletionContext(IDocument document, int offset, IProjectContent projectContent) { this.document = new ReadOnlyDocument(document, document.FileName); this.offset = offset; var unresolvedFile = CSharpParsingHelpers.CreateCSharpUnresolvedFile(this.document); this.projectContent = projectContent.AddOrUpdateFiles(unresolvedFile); completionContextProvider = new DefaultCompletionContextProvider(this.document, unresolvedFile); var compilation = this.projectContent.CreateCompilation(); var location = this.document.GetLocation(this.offset); typeResolveContextAtCaret = unresolvedFile.GetTypeResolveContext(compilation, location); }
private CSharpCompletionContext(ITextEditor editor, IList <string> conditionalSymbols, ICompilation compilation, IProjectContent projectContent, IDocument document, CSharpUnresolvedFile unresolvedFile, TextLocation caretLocation) { Debug.Assert(editor != null); Debug.Assert(unresolvedFile != null); Debug.Assert(compilation != null); Debug.Assert(projectContent != null); Debug.Assert(document != null); this.Editor = editor; this.Document = document; this.ConditionalSymbols = conditionalSymbols; this.Compilation = compilation; this.ProjectContent = projectContent; this.TypeResolveContextAtCaret = unresolvedFile.GetTypeResolveContext(compilation, caretLocation); this.CompletionContextProvider = new DefaultCompletionContextProvider(document, unresolvedFile); this.CompletionContextProvider.ConditionalSymbols.AddRange(conditionalSymbols); }
protected CSharpCompletionEngineBase(IProjectContent content, ICompletionContextProvider completionContextProvider, CSharpTypeResolveContext ctx) { if (content == null) { throw new ArgumentNullException("content"); } if (ctx == null) { throw new ArgumentNullException("ctx"); } if (completionContextProvider == null) { throw new ArgumentNullException("completionContextProvider"); } this.ProjectContent = content; this.CompletionContextProvider = completionContextProvider; this.ctx = ctx; }
/// <summary> /// Initializes a new instance of the <see cref="CSharpCompletionContext"/> class. /// </summary> /// <param name="document">The document, make sure the FileName property is set on the document.</param> /// <param name="offset">The offset.</param> /// <param name="projectContent">Content of the project.</param> /// <param name="usings">The usings.</param> public CSharpCompletionContext(IDocument document, int offset, IProjectContent projectContent, string usings = null) { OriginalDocument = document; OriginalOffset = offset; //if the document is a c# script we have to soround the document with some code. Document = PrepareCompletionDocument(document, ref offset, usings); Offset = offset; var syntaxTree = new CSharpParser().Parse(Document, Document.FileName); syntaxTree.Freeze(); var unresolvedFile = syntaxTree.ToTypeSystem(); ProjectContent = projectContent.AddOrUpdateFiles(unresolvedFile); //note: it's important that the project content is used that is returned after adding the unresolved file Compilation = ProjectContent.CreateCompilation(); var location = Document.GetLocation(Offset); Resolver = unresolvedFile.GetResolver(Compilation, location); TypeResolveContextAtCaret = unresolvedFile.GetTypeResolveContext(Compilation, location); CompletionContextProvider = new DefaultCompletionContextProvider(Document, unresolvedFile); }
public MonoCSharpCompletionEngine (CSharpCompletionTextEditorExtension ext, ICSharpCode.NRefactory.Editor.IDocument document, ICompletionContextProvider completionContextProvider, ICompletionDataFactory factory, ICSharpCode.NRefactory.TypeSystem.IProjectContent content, ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpTypeResolveContext ctx) : base (document, completionContextProvider, factory, content, ctx) { this.ext = ext; }
public IfVisitor(TextLocation loc, ICompletionContextProvider completionContextProvider) { this.loc = loc; this.completionContextProvider = completionContextProvider; this.IsValid = true; }
public MonoCSharpCompletionEngine (CSharpCompletionTextEditorExtension ext, ICSharpCode.NRefactory.Editor.IDocument document, ICompletionContextProvider completionContextProvider, ICompletionDataFactory factory, ICSharpCode.NRefactory.TypeSystem.IProjectContent content, ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpTypeResolveContext ctx) : base (document, completionContextProvider, factory, content, ctx) { this.ext = ext; this.mdRefactoringCtx = MDRefactoringContext.Create (ext.Document, ext.Document.Editor.Caret.Location); }
public MonoCSharpCompletionEngine(CSharpCompletionTextEditorExtension ext, ICSharpCode.NRefactory.Editor.IDocument document, ICompletionContextProvider completionContextProvider, ICompletionDataFactory factory, ICSharpCode.NRefactory.TypeSystem.IProjectContent content, ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpTypeResolveContext ctx) : base(document, completionContextProvider, factory, content, ctx) { this.ext = ext; }
private CSharpCompletionContext(ITextEditor editor, IList<string> conditionalSymbols, ICompilation compilation, IProjectContent projectContent, IDocument document, CSharpUnresolvedFile unresolvedFile, TextLocation caretLocation) { Debug.Assert(editor != null); Debug.Assert(unresolvedFile != null); Debug.Assert(compilation != null); Debug.Assert(projectContent != null); Debug.Assert(document != null); this.Editor = editor; this.Document = document; this.ConditionalSymbols = conditionalSymbols; this.Compilation = compilation; this.ProjectContent = projectContent; this.TypeResolveContextAtCaret = unresolvedFile.GetTypeResolveContext(compilation, caretLocation); this.CompletionContextProvider = new DefaultCompletionContextProvider(document, unresolvedFile); this.CompletionContextProvider.ConditionalSymbols.AddRange(conditionalSymbols); }
public MonoCSharpCompletionEngine(CSharpCompletionTextEditorExtension ext, ICSharpCode.NRefactory.Editor.IDocument document, ICompletionContextProvider completionContextProvider, ICompletionDataFactory factory, ICSharpCode.NRefactory.TypeSystem.IProjectContent content, ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpTypeResolveContext ctx) : base(document, completionContextProvider, factory, content, ctx) { this.ext = ext; this.mdRefactoringCtx = MDRefactoringContext.Create(ext.Document, ext.Document.Editor.Caret.Location); }