///////////////////////////////////////////////////////////////////////////// // Overridden Package Implementation #region Package Members /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); IComponentModel componentModel = (IComponentModel)this.GetService(typeof(SComponentModel)); IContentTypeRegistryService contentTypeRegistryService = componentModel.GetService <IContentTypeRegistryService>(); IFileExtensionRegistryService fileExtensionRegistryService = componentModel.GetService <IFileExtensionRegistryService>(); IContentType perlContentType = contentTypeRegistryService.GetContentType(Perl.Constants.ContentType); if (perlContentType != null) { IList <string> exts = fileExtensionRegistryService.GetExtensionsForContentType(perlContentType).ToList(); foreach (string ext in exts) { fileExtensionRegistryService.RemoveFileExtension(ext); } contentTypeRegistryService.RemoveContentType(Perl.Constants.ContentType); } perlContentType = contentTypeRegistryService.AddContentType(Perl.Constants.ContentType, new List <string> { "code" }); fileExtensionRegistryService.AddFileExtension(".pm", perlContentType); }
internal TaggerProvider(ITableManagerProvider provider, ITextDocumentFactoryService textDocumentFactoryService, IContentTypeRegistryService contentTypeRegistryService, IFileExtensionRegistryService fileExtensionRegistryService, ISonarLintDaemon daemon, SVsServiceProvider serviceProvider, ISonarLintSettings settings) { this.ErrorTableManager = provider.GetTableManager(StandardTables.ErrorsTable); this.TextDocumentFactoryService = textDocumentFactoryService; this.ContentTypeRegistryService = contentTypeRegistryService; this.FileExtensionRegistryService = fileExtensionRegistryService; this.ErrorTableManager.AddSource(this, StandardTableColumnDefinitions.DetailsExpander, StandardTableColumnDefinitions.ErrorSeverity, StandardTableColumnDefinitions.ErrorCode, StandardTableColumnDefinitions.ErrorSource, StandardTableColumnDefinitions.BuildTool, StandardTableColumnDefinitions.ErrorSource, StandardTableColumnDefinitions.ErrorCategory, StandardTableColumnDefinitions.Text, StandardTableColumnDefinitions.DocumentName, StandardTableColumnDefinitions.Line, StandardTableColumnDefinitions.Column, StandardTableColumnDefinitions.ProjectName); this.daemon = daemon; this.dte = (_DTE)serviceProvider.GetService(typeof(_DTE)); this.settings = settings; }
public ContentTypeManager(RadeonServiceProvider serviceProvider, IFileExtensionRegistryService fileExtensionRegistryService, IContentTypeRegistryService contentTypeRegistryService) { _serviceProvider = serviceProvider; _textEditorAdaptersFactoryService = serviceProvider.EditorAdaptersFactoryService; _fileExtensionRegistryService = fileExtensionRegistryService; _dte = serviceProvider.Dte; Asm1ContentType = contentTypeRegistryService.GetContentType(Constants.RadeonAsmSyntaxContentType); Asm2ContentType = contentTypeRegistryService.GetContentType(Constants.RadeonAsm2SyntaxContentType); AsmDocContentType = contentTypeRegistryService.GetContentType(Constants.RadeonAsmDocumentationContentType); var optionProvider = GeneralOptionProvider.Instance; _asm1Extensions = optionProvider.Asm1FileExtensions; _asm2Extensions = optionProvider.Asm2FileExtensions; _asmDocExtensions = new List <string>() { Constants.FileExtensionAsm1Doc, Constants.FileExtensionAsm2Doc }; _dte.Events.WindowEvents.WindowActivated += OnChangeActivatedWindow; optionProvider.OptionsUpdated += FileExtensionChanged; }
private void Cleanup() { if (this.wpfTextViewHost != null) { this.wpfTextViewHost.Closed -= OnTextViewHostClosed; this.wpfTextViewHost = null; } if (this.textView != null) { this.textView.BufferGraph.GraphBuffersChanged -= OnGraphBuffersChanged; this.textView.BufferGraph.GraphBufferContentTypeChanged -= OnGraphBufferContentTypeChanged; this.textView.Caret.PositionChanged -= OnCaretPositionChanged; this.textView.TextViewModel.EditBuffer.PostChanged -= OnBufferPostChanged; this.textView = null; } if (this.visual != null) { this.visual.ViewBuffer -= OnViewBuffer; this.visual = null; } if (this.settings != null) { this.settings.SettingsChanged -= OnSettingsChanged; this.settings = null; } this.extensionRegistry = null; }
///<summary>Gets a case-insensitive HashSet of all extensions for a given ContentType, including the leading dot.</summary> public static ISet <string> GetFileExtensionSet(this IFileExtensionRegistryService extService, IContentType contentType) { return(new HashSet <string>( extService.GetExtensionsForContentType(contentType) .Select(e => "." + e), StringComparer.OrdinalIgnoreCase )); }
public static void RegisterExtensions( IContentTypeRegistryService/*!*/ contentTypeRegistryService, IFileExtensionRegistryService/*!*/ fileExtensionRegistryService, IContentType/*!*/ contentType, IEnumerable<string>/*!*/ fileExtensions ) { foreach (var extension in fileExtensions) { if (fileExtensionRegistryService.GetContentTypeForExtension(extension) == contentTypeRegistryService.UnknownContentType) { fileExtensionRegistryService.AddFileExtension(extension, contentType); } } }
public DevViewMargin(IWpfTextViewHost wpfTextViewHost, IFileExtensionRegistryService fers) { model = new DevMarginViewModel(); this.wpfTextViewHost = wpfTextViewHost; this.extensionRegistry = fers; this.visual = new DevMarginVisual(model); this.visual.ViewBuffer += OnViewBuffer; VsfSettings.SettingsUpdated += OnSettingsUpdated; this.wpfTextViewHost.Closed += OnTextViewHostClosed; UpdateVisibility(); InitializeTextView(); RefreshBufferGraphList(); this.model.RefreshView(wpfTextViewHost.TextView); }
public static void RegisterExtensions( IContentTypeRegistryService /*!*/ contentTypeRegistryService, IFileExtensionRegistryService /*!*/ fileExtensionRegistryService, IContentType /*!*/ contentType, IEnumerable <string> /*!*/ fileExtensions ) { foreach (var extension in fileExtensions) { if (fileExtensionRegistryService.GetContentTypeForExtension(extension) == contentTypeRegistryService.UnknownContentType) { fileExtensionRegistryService.AddFileExtension(extension, contentType); } } }
public SonarLanguageRecognizer(IContentTypeRegistryService contentTypeRegistryService, IFileExtensionRegistryService fileExtensionRegistryService) { if (contentTypeRegistryService == null) { throw new ArgumentNullException(nameof(contentTypeRegistryService)); } if (fileExtensionRegistryService == null) { throw new ArgumentNullException(nameof(fileExtensionRegistryService)); } this.contentTypeRegistryService = contentTypeRegistryService; this.fileExtensionRegistryService = fileExtensionRegistryService; }
public static StyleSheet GetOrCreateStyleSheet(GraphNode node, IFileExtensionRegistryService fileService) { StyleSheet stylesheet = node.Id.GetNestedValueByName <StyleSheet>(CssGraphSchema.CssStyleSheet); if (stylesheet == null) { Uri url = node.Id.GetNestedValueByName <Uri>(CodeGraphNodeIdName.File); IContentType contentType = fileService.GetContentTypeForExtension(Path.GetExtension(url.LocalPath)); string contentTypeName = (contentType != null) ? contentType.TypeName : CssContentTypeDefinition.CssContentType; ICssParser parser = contentTypeName == LessContentTypeDefinition.LessContentType ? new LessParser() : new CssParser(); stylesheet = parser.Parse(File.ReadAllText(url.LocalPath), false); } return(stylesheet); }
private static void RegisterFileExtensions(IFileExtensionRegistryService fileExtensionRegistry, string sExtensions, IContentType contentType) { var extensions = sExtensions.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (var ext in extensions) { try { fileExtensionRegistry.AddFileExtension(ext, contentType); } catch (InvalidOperationException) { MessageBox.Show($"Extension {ext} is ignored because it is already registered " + $"with a different Visual Studio component. " + $"Please remove it from the GLSL language integration options page!", "GLSL language integration"); } } }
public DevViewMargin(IWpfTextViewHost wpfTextViewHost, IFileExtensionRegistryService fers, IVsfSettings settings) { model = new DevMarginViewModel(); this.wpfTextViewHost = wpfTextViewHost; this.extensionRegistry = fers; this.settings = settings; this.settings.SettingsChanged += OnSettingsChanged; this.wpfTextViewHost.Closed += OnTextViewHostClosed; this.visual = new DevMarginVisual(model, settings); this.visual.ViewBuffer += OnViewBuffer; UpdateVisibility(); InitializeTextView(); RefreshBufferGraphList(); this.model.RefreshView(wpfTextViewHost.TextView); }
private static void RegisterFileExtensions(IFileExtensionRegistryService fileExtensionRegistry, string sExtensions, IContentType contentType) { var extensions = sExtensions.Split(new char[] { ';', ' ' }, StringSplitOptions.RemoveEmptyEntries); foreach (var ext in extensions) { try { fileExtensionRegistry.AddFileExtension(ext, contentType); } catch (InvalidOperationException) { var titel = "GLSL language integration"; var message = $"{titel}:Extension {ext} is ignored because it is already registered " + $"with a different Visual Studio component. " + $"Please remove it from the {titel} options page!"; VsStatusBar.SetText(message); } } }
private static void RegisterFileExtensions(IFileExtensionRegistryService fileExtensionRegistry, string sExtensions, IContentType contentType, ILogger logger) { var extensions = sExtensions.Split(new char[] { ';', ' ' }, StringSplitOptions.RemoveEmptyEntries); foreach (var ext in extensions) { try { //fileExtensionRegistry.RemoveFileExtension(ext); fileExtensionRegistry.AddFileExtension(ext, contentType); } catch (InvalidOperationException ioe) { var otherContentType = fileExtensionRegistry.GetContentTypeForExtension(ext); const string title = "GLSL language integration"; var message = $"{title}:Extension '{ext}' is ignored because it is already registered " + $"with the content type '{otherContentType.TypeName}'. " + $"Please use a different extension on the {title} options page!" + $"Following is the detailed exception message {ioe}"; logger.Log(message, true); } } }
public FileExtensionsOption([Import] IContentTypeRegistryService contentTypeRegistry, [Import] IFileExtensionRegistryService fileExtensionRegistry) { var options = OptionsPagePackage.Options; RegisterFileExtensions(fileExtensionRegistry, options.AutoDetectShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.AutoDetect)); RegisterFileExtensions(fileExtensionRegistry, options.FragmentShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.Fragment)); RegisterFileExtensions(fileExtensionRegistry, options.VertexShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.Vertex)); RegisterFileExtensions(fileExtensionRegistry, options.GeometryShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.Geometry)); RegisterFileExtensions(fileExtensionRegistry, options.ComputeShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.Compute)); RegisterFileExtensions(fileExtensionRegistry, options.TessellationControlShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.TessellationControl)); RegisterFileExtensions(fileExtensionRegistry, options.TessellationEvaluationShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.TessellationEvaluation)); RegisterFileExtensions(fileExtensionRegistry, options.MeshShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.Mesh)); RegisterFileExtensions(fileExtensionRegistry, options.TaskShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.Task)); RegisterFileExtensions(fileExtensionRegistry, options.RayGenerationShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.RayGeneration)); RegisterFileExtensions(fileExtensionRegistry, options.RayIntersectionShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.RayIntersection)); RegisterFileExtensions(fileExtensionRegistry, options.RayMissShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.RayMiss)); RegisterFileExtensions(fileExtensionRegistry, options.RayAnyHitShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.RayAnyHit)); RegisterFileExtensions(fileExtensionRegistry, options.RayClosestHitShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.RayClosestHit)); RegisterFileExtensions(fileExtensionRegistry, options.RayCallableShaderFileExtensions, contentTypeRegistry.GetContentType(ShaderContentTypes.RayCallable)); }
public FileExtensionsOption([Import] IContentTypeRegistryService contentTypeRegistry, [Import] IFileExtensionRegistryService fileExtensionRegistry) { var options = OptionsPagePackage.Options; if (options is null) { return; } RegisterFileExtensions(fileExtensionRegistry, options.FragmentShaderFileExtensions, contentTypeRegistry.GetContentType(ContentTypesGlsl.FragmentShader)); RegisterFileExtensions(fileExtensionRegistry, options.VertexShaderFileExtensions, contentTypeRegistry.GetContentType(ContentTypesGlsl.VertexShader)); RegisterFileExtensions(fileExtensionRegistry, options.GeometryShaderFileExtensions, contentTypeRegistry.GetContentType(ContentTypesGlsl.GeometryShader)); RegisterFileExtensions(fileExtensionRegistry, options.ComputeShaderFileExtensions, contentTypeRegistry.GetContentType(ContentTypesGlsl.ComputeShader)); RegisterFileExtensions(fileExtensionRegistry, options.TessControlShaderFileExtensions, contentTypeRegistry.GetContentType(ContentTypesGlsl.TessControlShader)); RegisterFileExtensions(fileExtensionRegistry, options.TessEvaluationShaderFileExtensions, contentTypeRegistry.GetContentType(ContentTypesGlsl.TessEvaluationShader)); }
public ScssDependencyGraph(IFileExtensionRegistryService fileExtensionRegistry) : base(".scss", fileExtensionRegistry) { }
public CssDependencyGraph(string extension, IFileExtensionRegistryService fileExtensionRegistry) : base(fileExtensionRegistry.GetContentTypeForExtension(extension.TrimStart('.')), fileExtensionRegistry) { Extension = extension; parserFactory = CssParserLocator.FindComponent(ContentType); }
internal PythonRuntimeHost(IContentTypeRegistryService /*!*/ contentTypeRegistryService, IFileExtensionRegistryService /*!*/ fileExtensionRegistryService) { _engine = Python.CreateEngine(new Dictionary <string, object> { { "NoAssemblyResolveHook", true } }); _contentType = contentTypeRegistryService.GetContentType(PythonCoreConstants.ContentType); CoreUtils.RegisterExtensions(contentTypeRegistryService, fileExtensionRegistryService, _contentType, _engine.Setup.FileExtensions); }
private void Cleanup() { if ( this.wpfTextViewHost != null ) { this.wpfTextViewHost.Closed -= OnTextViewHostClosed; this.wpfTextViewHost = null; } if ( this.textView != null ) { this.textView.BufferGraph.GraphBuffersChanged -= OnGraphBuffersChanged; this.textView.BufferGraph.GraphBufferContentTypeChanged -= OnGraphBufferContentTypeChanged; this.textView.Caret.PositionChanged -= OnCaretPositionChanged; this.textView.TextViewModel.EditBuffer.PostChanged -= OnBufferPostChanged; this.textView = null; } if ( this.visual != null ) { this.visual.ViewBuffer -= OnViewBuffer; this.visual = null; } if ( this.settings != null ) { this.settings.SettingsChanged -= OnSettingsChanged; this.settings = null; } this.extensionRegistry = null; }
public DacPackageServicesProvider(ICoreShell coreShell, IFileExtensionRegistryService fers, IContentTypeRegistryService ctrs) { _coreShell = coreShell; _fers = fers; _ctrs = ctrs; }
public RegisterVSFileExtensions(IContentTypeRegistryService contentTypeRegistry, IFileExtensionRegistryService fileExtensionRegistry, ILogger logger, IShaderFileExtensions settings) { if (contentTypeRegistry is null) { throw new System.ArgumentNullException(nameof(contentTypeRegistry)); } if (fileExtensionRegistry is null) { throw new System.ArgumentNullException(nameof(fileExtensionRegistry)); } if (logger is null) { throw new System.ArgumentNullException(nameof(logger)); } if (settings is null) { throw new System.ArgumentNullException(nameof(settings)); } void Register(string sExtensions, string contentType) => RegisterFileExtensions(fileExtensionRegistry, sExtensions, contentTypeRegistry.GetContentType(contentType), logger); Register(settings.AutoDetectShaderFileExtensions, ShaderContentTypes.AutoDetect); Register(settings.FragmentShaderFileExtensions, ShaderContentTypes.Fragment); Register(settings.VertexShaderFileExtensions, ShaderContentTypes.Vertex); Register(settings.GeometryShaderFileExtensions, ShaderContentTypes.Geometry); Register(settings.ComputeShaderFileExtensions, ShaderContentTypes.Compute); Register(settings.TessellationControlShaderFileExtensions, ShaderContentTypes.TessellationControl); Register(settings.TessellationEvaluationShaderFileExtensions, ShaderContentTypes.TessellationEvaluation); Register(settings.MeshShaderFileExtensions, ShaderContentTypes.Mesh); Register(settings.TaskShaderFileExtensions, ShaderContentTypes.Task); Register(settings.RayGenerationShaderFileExtensions, ShaderContentTypes.RayGeneration); Register(settings.RayIntersectionShaderFileExtensions, ShaderContentTypes.RayIntersection); Register(settings.RayMissShaderFileExtensions, ShaderContentTypes.RayMiss); Register(settings.RayAnyHitShaderFileExtensions, ShaderContentTypes.RayAnyHit); Register(settings.RayClosestHitShaderFileExtensions, ShaderContentTypes.RayClosestHit); Register(settings.RayCallableShaderFileExtensions, ShaderContentTypes.RayCallable); }
protected VsDependencyGraph(IContentType contentType, IFileExtensionRegistryService fileExtensionRegistry) { ContentType = contentType; extensions = fileExtensionRegistry.GetFileExtensionSet(contentType); RescanComplete = TplExtensions.CompletedTask; }
internal RubyRuntimeHost(IContentTypeRegistryService/*!*/ contentTypeRegistryService, IFileExtensionRegistryService/*!*/ fileExtensionRegistryService) { _engine = Ruby.CreateEngine((setup) => { setup.Options["NoAssemblyResolveHook"] = true; }); _contentType = contentTypeRegistryService.GetContentType(RubyCoreConstants.ContentType); CoreUtils.RegisterExtensions(contentTypeRegistryService, fileExtensionRegistryService, _contentType, _engine.Setup.FileExtensions); }
internal PythonRuntimeHost(IContentTypeRegistryService/*!*/ contentTypeRegistryService, IFileExtensionRegistryService/*!*/ fileExtensionRegistryService) { _engine = Python.CreateEngine(new Dictionary<string, object> { { "NoAssemblyResolveHook", true } }); _contentType = contentTypeRegistryService.GetContentType(PythonCoreConstants.ContentType); CoreUtils.RegisterExtensions(contentTypeRegistryService, fileExtensionRegistryService, _contentType, _engine.Setup.FileExtensions); }
internal RubyRuntimeHost(IContentTypeRegistryService /*!*/ contentTypeRegistryService, IFileExtensionRegistryService /*!*/ fileExtensionRegistryService) { _engine = Ruby.CreateEngine((setup) => { setup.Options["NoAssemblyResolveHook"] = true; }); _contentType = contentTypeRegistryService.GetContentType(RubyCoreConstants.ContentType); CoreUtils.RegisterExtensions(contentTypeRegistryService, fileExtensionRegistryService, _contentType, _engine.Setup.FileExtensions); }