private static IErrorList getErrorList() { DTE2 dte = (DTE2)Package.GetGlobalService(typeof(DTE)); IErrorList errorList = dte.ToolWindows.ErrorList as IErrorList; return(errorList); }
private static ITableEntryHandle getSelectedErrorListEntry() { IErrorList errorList = getErrorList(); ITableEntryHandle selected = errorList.TableControl.SelectedEntry; return(selected); }
public VisualStudioDiagnosticListTable( SVsServiceProvider serviceProvider, VisualStudioWorkspace workspace, IDiagnosticService diagnosticService, ExternalErrorDiagnosticUpdateSource errorSource, ITableManagerProvider provider) : this(serviceProvider, (Workspace)workspace, diagnosticService, errorSource, provider) { ConnectWorkspaceEvents(); _errorList = serviceProvider.GetService(typeof(SVsErrorList)) as IErrorList; if (_errorList == null) { AddInitialTableSource(workspace.CurrentSolution, _liveTableSource); return; } _errorList.PropertyChanged += OnErrorListPropertyChanged; AddInitialTableSource(workspace.CurrentSolution, GetCurrentDataSource()); SuppressionStateColumnDefinition.SetDefaultFilter(_errorList.TableControl); if (ErrorListHasFullSolutionAnalysisButton()) { SetupErrorListFullSolutionAnalysis(workspace); } }
public VisualStudioDiagnosticListTable( VisualStudioWorkspaceImpl workspace, IDiagnosticService diagnosticService, ITableManagerProvider provider, IErrorList errorList ) : base(workspace, provider) { _errorList = errorList; _liveTableSource = new LiveTableDataSource( workspace, diagnosticService, IdentifierString, workspace.ExternalErrorDiagnosticUpdateSource ); _buildTableSource = new BuildTableDataSource( workspace, workspace.ExternalErrorDiagnosticUpdateSource ); AddInitialTableSource(Workspace.CurrentSolution, GetCurrentDataSource()); ConnectWorkspaceEvents(); _errorList.PropertyChanged += OnErrorListPropertyChanged; }
/// <summary> /// Finds the matching nodes of a <see cref="IManifestNumberExpression"/>. /// </summary> /// <param name="node">The agent expression to check.</param> /// <param name="errorList">The list of errors found.</param> /// <param name="resolvedResult">The expression result types upon return.</param> /// <param name="resolvedException">Exceptions the expression can throw upon return.</param> /// <param name="constantSourceList">Sources of the constant expression upon return, if any.</param> /// <param name="expressionConstant">The constant type upon return.</param> public static bool ResolveCompilerReferences(IManifestNumberExpression node, IErrorList errorList, out IResultType resolvedResult, out IResultException resolvedException, out ISealableList <IExpression> constantSourceList, out ILanguageConstant expressionConstant) { resolvedResult = null; resolvedException = null; constantSourceList = new SealableList <IExpression>(); expressionConstant = NeutralLanguageConstant.NotConstant; IClass EmbeddingClass = node.EmbeddingClass; string NumberText = node.ValidText.Item; ISealableDictionary <ITypeName, ICompiledType> TypeTable = EmbeddingClass.TypeTable; if (!Expression.IsLanguageTypeAvailable(LanguageClasses.Number.Guid, node, out ITypeName NumberTypeName, out ICompiledType NumberType)) { errorList.AddError(new ErrorNumberTypeMissing(node)); return(false); } resolvedResult = new ResultType(NumberTypeName, NumberType, string.Empty); resolvedException = new ResultException(); FormattedNumber FormattedNumber = FormattedNumber.Parse(NumberText); Debug.Assert(string.IsNullOrEmpty(FormattedNumber.InvalidText)); expressionConstant = new NumberLanguageConstant(FormattedNumber.Value); #if COVERAGE Debug.Assert(!node.IsComplex); #endif return(true); }
/// <summary> /// Finds the matching nodes of a <see cref="IUnaryNotExpression"/>. /// </summary> /// <param name="node">The agent expression to check.</param> /// <param name="errorList">The list of errors found.</param> /// <param name="resolvedResult">The expression result types upon return.</param> /// <param name="resolvedException">Exceptions the expression can throw upon return.</param> /// <param name="constantSourceList">Sources of the constant expression upon return, if any.</param> /// <param name="expressionConstant">The constant value upon return, if any.</param> public static bool ResolveCompilerReferences(IUnaryNotExpression node, IErrorList errorList, out IResultType resolvedResult, out IResultException resolvedException, out ISealableList <IExpression> constantSourceList, out ILanguageConstant expressionConstant) { resolvedResult = null; resolvedException = null; constantSourceList = new SealableList <IExpression>(); expressionConstant = NeutralLanguageConstant.NotConstant; IExpression RightExpression = (IExpression)node.RightExpression; IClass EmbeddingClass = node.EmbeddingClass; bool IsRightClassType = Expression.GetClassTypeOfExpression(RightExpression, errorList, out IClassType RightExpressionClassType); if (!IsRightClassType) { return(false); } Expression.IsLanguageTypeAvailable(LanguageClasses.Boolean.Guid, node, out ITypeName BooleanTypeName, out ICompiledType BooleanType); Expression.IsLanguageTypeAvailable(LanguageClasses.Event.Guid, node, out ITypeName EventTypeName, out ICompiledType EventType); Debug.Assert(RightExpressionClassType == BooleanType || RightExpressionClassType == EventType); node.SetIsEventExpression(RightExpressionClassType != BooleanType); constantSourceList.Add(RightExpression); resolvedResult = new ResultType(BooleanTypeName, BooleanType, string.Empty); ResultException.Propagate(RightExpression.ResolvedException, out resolvedException); #if COVERAGE Debug.Assert(node.IsComplex); #endif return(true); }
public Bookmark(BookmarkType bookmarkType, int lineNumber) { BookmarkType = bookmarkType; LineNumber = lineNumber; _errorList = IoC.Get <IErrorList>(); }
/// <summary> /// Finds the matching nodes of a <see cref="IResultOfExpression"/>. /// </summary> /// <param name="node">The agent expression to check.</param> /// <param name="errorList">The list of errors found.</param> /// <param name="resolvedResult">The expression result types upon return.</param> /// <param name="resolvedException">Exceptions the expression can throw upon return.</param> /// <param name="constantSourceList">Sources of the constant expression upon return, if any.</param> /// <param name="expressionConstant">The expression constant upon return.</param> public static bool ResolveCompilerReferences(IResultOfExpression node, IErrorList errorList, out IResultType resolvedResult, out IResultException resolvedException, out ISealableList <IExpression> constantSourceList, out ILanguageConstant expressionConstant) { resolvedResult = null; resolvedException = null; constantSourceList = new SealableList <IExpression>(); expressionConstant = NeutralLanguageConstant.NotConstant; IExpression Source = (IExpression)node.Source; IResultType ResolvedSourceResult = Source.ResolvedResult.Item; int ResultNameIndex = ResolvedSourceResult.ResultNameIndex; if (ResultNameIndex < 0) { errorList.AddError(new ErrorInvalidExpression(node)); return(false); } Debug.Assert(ResolvedSourceResult.Preferred != null); resolvedResult = new ResultType(ResolvedSourceResult.Preferred); constantSourceList.Add(Source); ResultException.Propagate(Source.ResolvedException, out resolvedException); #if COVERAGE Debug.Assert(node.IsComplex); #endif return(true); }
private static bool ResolveDiscrete(IQueryExpression node, IErrorList errorList, IDiscrete resolvedFinalDiscrete, ref ResolvedExpression resolvedExpression) { // This is enforced by the caller. bool IsNumberTypeAvailable = Expression.IsLanguageTypeAvailable(LanguageClasses.Number.Guid, node, out ITypeName NumberTypeName, out ICompiledType NumberType); Debug.Assert(IsNumberTypeAvailable); resolvedExpression.ResolvedResult = new ResultType(NumberTypeName, NumberType, resolvedFinalDiscrete.ValidDiscreteName.Item.Name); resolvedExpression.ResolvedException = new ResultException(); if (resolvedFinalDiscrete.NumericValue.IsAssigned) { IExpression NumericValue = (IExpression)resolvedFinalDiscrete.NumericValue.Item; resolvedExpression.ConstantSourceList.Add(NumericValue); } else { resolvedExpression.ExpressionConstant = new DiscreteLanguageConstant(resolvedFinalDiscrete); } resolvedExpression.SelectedResultList = new SealableList <IParameter>(); resolvedExpression.FeatureCall = new FeatureCall(); return(true); }
/// <summary> /// Validates number types. If not valid, adds an error. /// </summary> /// <param name="errorList">The list of errors found.</param> public void ValidateNumberType(IErrorList errorList) { foreach (IEntityDeclaration EntityDeclaration in EntityDeclarationList) { EntityDeclaration.ValidateNumberType(errorList); } foreach (IInstruction Instruction in InitInstructionList) { Instruction.ValidateNumberType(errorList); } ((IExpression)WhileCondition).ValidateNumberType(errorList); foreach (IInstruction Instruction in LoopInstructionList) { Instruction.ValidateNumberType(errorList); } foreach (IInstruction Instruction in IterationInstructionList) { Instruction.ValidateNumberType(errorList); } if (Variant.IsAssigned) { ((IExpression)Variant.Item).ValidateNumberType(errorList); } }
/// <summary> /// Validates number types. If not valid, adds an error. /// </summary> /// <param name="errorList">The list of errors found.</param> public void ValidateNumberType(IErrorList errorList) { foreach (IQueryOverload Overload in OverloadList) { Overload.ValidateNumberType(errorList); } }
private bool CompareEffectiveFlags(InheritedInstanceInfo importedInstance, IErrorList errorList, IClassType localClassType) { bool Result = true; importedInstance.IsKept = importedInstance.EffectiveInstance.Item.Instance.IsKept; importedInstance.IsDiscontinued = importedInstance.EffectiveInstance.Item.Instance.IsDiscontinued; // If the effective instance is a redefine. if (importedInstance.EffectiveInstance.Item.Ancestor == localClassType && importedInstance.EffectiveInstance.Item.Instance.Feature.ResolvedAgentType.IsAssigned) { ICompiledType DescendantFeatureType = importedInstance.EffectiveInstance.Item.Instance.Feature.ResolvedAgentType.Item; IList <InstanceNameInfo> InstanceList = importedInstance.PrecursorInstanceList; foreach (InstanceNameInfo Item in InstanceList) { if (Item == importedInstance.EffectiveInstance.Item) { continue; } ICompiledType AncestorFeatureType = Item.Instance.Feature.ResolvedAgentType.Item; if (!ObjectType.TypeConformToBase(DescendantFeatureType, AncestorFeatureType, errorList, (ISource)importedInstance.EffectiveInstance.Item.Instance.Feature, isConversionAllowed: false)) { errorList.AddError(new ErrorInheritanceConflict(Item.Location, Item.Name.Name)); Result = false; } } } return(Result); }
/// <summary> /// Initializes a new instance of the <see cref="FixSuggestedActionsSource"/> class. /// </summary> /// <param name="textView"> /// The <see cref="ITextView"/> for which this source will offer fix suggestions. /// </param> /// <param name="textBuffer"> /// The <see cref="ITextBuffer"/> associated with the <see cref="ITextView"/> for which this /// source will offer fix suggestions. /// </param> /// <param name="persistentSpanFactory"> /// A factory for creating the persistent spans that specify the error locations and the /// replacement locations (which are not necessarily the same). /// </param> /// <param name="previewProvider"> /// Creates the XAML UIControl that displays the preview. /// </param> public FixSuggestedActionsSource( ITextView textView, ITextBuffer textBuffer, IPersistentSpanFactory persistentSpanFactory, IPreviewProvider previewProvider) { ThreadHelper.ThrowIfNotOnUIThread(); this.textView = textView; this.textBuffer = textBuffer; this.persistentSpanFactory = persistentSpanFactory; this.previewProvider = previewProvider; // when text changed and sarif errors item changes, need to refresh errorInFile IErrorList errorList = ServiceProvider.GlobalProvider.GetService(typeof(SVsErrorList)) as IErrorList; this.errorListTableControl = errorList?.TableControl; this.errorListTableControl.EntriesChanged += this.ErrorListTableControl_EntriesChanged; this.RefreshPersistentSpans(); // Keep track of which error is associated with each suggested action, so that when // the action is invoked, the associated error can be marked as fixed. When we mark // an error as fixed, we tell VS to recompute the list of suggested actions, so that // it doesn't suggest actions for errors that are already fixed. this.fixToErrorDictionary = new Dictionary <FixSuggestedAction, SarifErrorListItem>(); }
/// <summary> /// Validates number types. If not valid, adds an error. /// </summary> /// <param name="errorList">The list of errors found.</param> public void ValidateNumberType(IErrorList errorList) { foreach (IArgument Argument in ArgumentList) { Argument.ValidateNumberType(errorList); } }
public SceneEditorViewModel(LanguageDefinitionManager languageDefinitionManager, IErrorList errorList, IShell shell) : base(languageDefinitionManager) { _errorList = errorList; _shell = shell; }
private static int Compile(string Namespace, string SourceFileName, string ErrorFileName, string OutputRootFolder, bool ActivateVerification, Guid singledGuid, string singledName) { Compiler c = new Compiler(); c.Compile(SourceFileName); IErrorList ErrorList = c.ErrorList; if (ErrorList.IsEmpty) { TargetCSharp t = new TargetCSharp(c, Namespace); t.OutputRootFolder = OutputRootFolder; t.SingledGuid = singledGuid; t.SingledName = singledName; t.SourceFileName = SourceFileName; t.Translate(); ErrorList = t.ErrorList; } Debug.WriteLine(ErrorList.ToString()); if (!ErrorList.IsEmpty) { ReportErrors(ErrorFileName, ErrorList); return(-2); } return(0); }
private static bool IsWithinGetter(ISource source, IErrorList errorList, out ITypeName resultTypeName, out ICompiledType resultType) { resultTypeName = null; resultType = null; if (source.EmbeddingOverload is IQueryOverload AsQueryOverload) { return(CheckQueryConsistency(source, AsQueryOverload, errorList, out resultTypeName, out resultType)); } else if (source.EmbeddingFeature is IPropertyFeature AsPropertyFeature) { if (CheckGetterConsistency(source, AsPropertyFeature.GetterBody, errorList)) { resultTypeName = AsPropertyFeature.ResolvedEntityTypeName.Item; resultType = AsPropertyFeature.ResolvedEntityType.Item; return(true); } } else if (source.EmbeddingFeature is IIndexerFeature AsIndexerFeature) { if (CheckGetterConsistency(source, AsIndexerFeature.GetterBody, errorList)) { resultTypeName = AsIndexerFeature.ResolvedEntityTypeName.Item; resultType = AsIndexerFeature.ResolvedEntityType.Item; return(true); } } else { errorList.AddError(new ErrorUnavailableResult(source)); } return(false); }
public Bookmark(BookmarkType bookmarkType, int lineNumber) { BookmarkType = bookmarkType; LineNumber = lineNumber; _errorList = IoC.Get<IErrorList>(); }
/// <summary> /// Finds the matching nodes of a <see cref="IManifestStringExpression"/>. /// </summary> /// <param name="node">The agent expression to check.</param> /// <param name="errorList">The list of errors found.</param> /// <param name="resolvedResult">The expression result types upon return.</param> /// <param name="resolvedException">Exceptions the expression can throw upon return.</param> /// <param name="constantSourceList">Sources of the constant expression upon return, if any.</param> /// <param name="expressionConstant">The expression constant upon return.</param> public static bool ResolveCompilerReferences(IManifestStringExpression node, IErrorList errorList, out IResultType resolvedResult, out IResultException resolvedException, out ISealableList <IExpression> constantSourceList, out ILanguageConstant expressionConstant) { resolvedResult = null; resolvedException = null; constantSourceList = new SealableList <IExpression>(); expressionConstant = NeutralLanguageConstant.NotConstant; IClass EmbeddingClass = node.EmbeddingClass; string ValidText = node.ValidText.Item; if (!Expression.IsLanguageTypeAvailable(LanguageClasses.String.Guid, node, out ITypeName StringTypeName, out ICompiledType StringType)) { errorList.AddError(new ErrorStringTypeMissing(node)); return(false); } resolvedResult = new ResultType(StringTypeName, StringType, string.Empty); resolvedException = new ResultException(); expressionConstant = new StringLanguageConstant(ValidText); #if COVERAGE Debug.Assert(!node.IsComplex); #endif return(true); }
public static List <VisualStudioErrorCodeItem> GetCurrentLineErrorList() { ThreadHelper.ThrowIfNotOnUIThread(); string errorCode; List <VisualStudioErrorCodeItem> visualStudioErrorCodeList = new List <VisualStudioErrorCodeItem>(); List <ErrorItem> errorItemsList = getErrorListByCurrentLine(); IErrorList errrorList = getErrorList(); IEnumerable <ITableEntryHandle> tableEntries = errrorList.TableControl.Entries; foreach (ErrorItem item in errorItemsList) { errorCode = getErrorCodeFromErrorItem(tableEntries, item); visualStudioErrorCodeList.Add(new VisualStudioErrorCodeItem { Description = item.Description, Line = item.Line, Column = item.Column, File = item.FileName, Project = item.Project, ErrorCode = errorCode }); } return(visualStudioErrorCodeList); }
/// <summary> /// Validates number types. If not valid, adds an error. /// </summary> /// <param name="errorList">The list of errors found.</param> public void ValidateNumberType(IErrorList errorList) { foreach (IFeature Feature in FeatureList) { Feature.ValidateNumberType(errorList); } }
public ErrorsController(IDialControllerHost host) { _host = host; _dte = host.DTE; _errorList = _dte.ToolWindows.ErrorList as IErrorList; _events = _dte.Events.WindowEvents; _events.WindowActivated += WindowActivated; }
/// <summary> /// Validates number types. If not valid, adds an error. /// </summary> /// <param name="errorList">The list of errors found.</param> public void ValidateNumberType(IErrorList errorList) { if (DefaultValue.IsAssigned) { IExpression SourceExpression = (IExpression)DefaultValue.Item; SourceExpression.ValidateNumberType(errorList); } }
static ErrorListManager() { _projects = new Dictionary <Guid, ErrorListManager>(); _gate = new object(); _errorList = XSharpProjectPackage.XInstance.ErrorList; _manager = _errorList.TableControl.Manager; _provider = new ErrorListProvider(_manager); }
/// <summary> /// Adds the given results to the error list /// </summary> public static void AddRange(this IErrorList errorList, string document, IEnumerable <System.ComponentModel.DataAnnotations.ValidationResult> results) { Guard.NotNull(() => errorList, errorList); if (results != null) { results.ForEach(r => errorList.AddMessage(r.ErrorMessage, document, ErrorCategory.Error)); } }
/// this is for test only private VisualStudioDiagnosticListTable(Workspace workspace, IThreadingContext threadingContext, ExternalErrorDiagnosticUpdateSource errorSource, ITableManagerProvider provider) : base(workspace, provider) { _liveTableSource = null !; _buildTableSource = null !; _errorList = null !; AddInitialTableSource(workspace.CurrentSolution, new BuildTableDataSource(workspace, threadingContext, errorSource)); }
/// this is for test only private VisualStudioDiagnosticListTable(Workspace workspace, IThreadingContext threadingContext, IDiagnosticService diagnosticService, ITableManagerProvider provider) : base(workspace, provider) { _liveTableSource = null !; _buildTableSource = null !; _errorList = null !; AddInitialTableSource(workspace.CurrentSolution, new LiveTableDataSource(workspace, threadingContext, diagnosticService, IdentifierString)); }
/// <summary> /// Validates number types. If not valid, adds an error. /// </summary> /// <param name="errorList">The list of errors found.</param> public void ValidateNumberType(IErrorList errorList) { foreach (IEntityDeclaration EntityDeclaration in ParameterList) { EntityDeclaration.ValidateNumberType(errorList); } ((IBody)CommandBody).ValidateNumberType(errorList); }
/// <summary> /// Initializes a new instance of the <see cref="ErrorListDiagnosticProvider"/> class. /// </summary> /// <param name="errorList">The <see cref="IErrorList"/>.</param> public ErrorListDiagnosticProvider(IErrorList errorList) { if (errorList == null) { throw new ArgumentNullException(nameof(errorList)); } WeakEventManager <IWpfTableControl, EntriesChangedEventArgs> .AddHandler(errorList.TableControl, nameof(IWpfTableControl.EntriesChanged), OnErrorListEntriesChanged); }
/// <summary> /// Validates number types. If not valid, adds an error. /// </summary> /// <param name="errorList">The list of errors found.</param> public void ValidateNumberType(IErrorList errorList) { ((IScope)Instructions).ValidateNumberType(errorList); foreach (IInstruction Instruction in CleanupList) { Instruction.ValidateNumberType(errorList); } }
private static MenuCommand CreateDisableRuleMenuCommand(IErrorList errorList, IUserSettingsProvider userSettingsProvider, IActiveSolutionBoundTracker solutionTracker, ILogger logger) { var dummyMenuService = new DummyMenuCommandService(); new DisableRuleCommand(dummyMenuService, errorList, userSettingsProvider, solutionTracker, logger); dummyMenuService.AddedMenuCommands.Count.Should().Be(1); return(dummyMenuService.AddedMenuCommands[0]); }
public Module() { Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); _agents = new List<IAgent>(); _backendContexts = new List<IBackendContext>(); _errorList = IoC.Get<IErrorList>(); _output = IoC.Get<IOutput>(); }
public Bookmark(BookmarkType bookmarkType, TextMarkerService textMarkerService, int lineNumber, int column, int startOffset, int length, string message, string fileName) { BookmarkType = bookmarkType; LineNumber = lineNumber; Message = message; _textMarkerService = textMarkerService; _errorList = IoC.Get<IErrorList>(); InitializeBookmark(textMarkerService, lineNumber, column, startOffset, length, message, fileName); }
/// <summary> /// Initializes a new instance of the <see cref="SubmitStructureResponseImpl"/> class. /// </summary> /// <param name="structureReference"> /// The structure reference dataStructureObject. /// </param> /// <param name="errorList"> /// The error list. /// </param> /// /// /// <exception cref="ArgumentException"> /// Throws ArgumentException. /// </exception> public SubmitStructureResponseImpl(IStructureReference structureReference, IErrorList errorList) { this._structureReference = structureReference; this._errorList = errorList; if (structureReference != null && structureReference.TargetUrn == null) { throw new ArgumentException("SubmitStructureResponseImpl expects a complete IStructureReference"); } if (!this.IsError) { if (structureReference == null) { throw new ArgumentException("Sucessful SubmitStructureResponse expects a IStructureReference"); } } }
public VisualStudioDiagnosticListTable( SVsServiceProvider serviceProvider, VisualStudioWorkspace workspace, IDiagnosticService diagnosticService, ExternalErrorDiagnosticUpdateSource errorSource, ITableManagerProvider provider) : this(serviceProvider, (Workspace)workspace, diagnosticService, errorSource, provider) { ConnectWorkspaceEvents(); _errorList = serviceProvider.GetService(typeof(SVsErrorList)) as IErrorList; if (_errorList == null) { AddInitialTableSource(workspace.CurrentSolution, _liveTableSource); return; } _errorList.PropertyChanged += OnErrorListPropertyChanged; AddInitialTableSource(workspace.CurrentSolution, GetCurrentDataSource()); }
/// <summary> /// Initializes a new instance of the <see cref="SubmitRegistrationResponseImpl"/> class. /// </summary> /// <param name="registration"> /// The registration. /// </param> /// <param name="errors"> /// The errors. /// </param> public SubmitRegistrationResponseImpl(IRegistrationObject registration, IErrorList errors) { this._registration = registration; this._errors = errors; }
/// <summary> /// Initializes a new instance of the <see cref="SubmitSubscriptionResponseImpl"/> class. /// </summary> /// <param name="structureReference"> /// The structure reference. /// </param> /// <param name="errorList"> /// The error list. /// </param> /// <param name="subscriberId"> /// The subscriber id. /// </param> public SubmitSubscriptionResponseImpl( IStructureReference structureReference, IErrorList errorList, string subscriberId) : base(structureReference, errorList) { this._subscriberId = subscriberId; }
public CodeCompiler(IEditorProvider editorProvider, IOutput output, IErrorList errorList) { _editorProvider = editorProvider; _output = output; _errorList = errorList; }