public void RequestAnalysis(string path, string charset, IList <IContentType> contentTypes)
        {
            IssueTagger tracker;

            if (taggers.TryGetValue(path, out tracker))
            {
                foreach (IContentType type in contentTypes)
                {
                    if (type.IsOfType("JavaScript"))
                    {
                        daemon.RequestAnalysis(path, charset, "js", null, this);
                        return;
                    }
                    if (type.IsOfType("C/C++"))
                    {
                        string sqLanguage;
                        string json = CFamily.TryGetConfig(tracker.ProjectItem, path, out sqLanguage);
                        if (json != null && sqLanguage != null)
                        {
                            daemon.RequestAnalysis(path, charset, sqLanguage, json, this);
                        }
                        return;
                    }
                }
                VsShellUtils.WriteToSonarLintOutputPane(ServiceProvider.GlobalProvider, "Unsupported content type for " + path);
            }
        }
Esempio n. 2
0
        public void RequestAnalysis(string path, string charset, IEnumerable <SonarLanguage> detectedLanguages)
        {
            IssueTagger tracker;

            if (taggers.TryGetValue(path, out tracker))
            {
                foreach (var language in detectedLanguages)
                {
                    switch (language)
                    {
                    case SonarLanguage.Javascript:
                        daemon.RequestAnalysis(path, charset, "js", null, this);
                        break;

                    case SonarLanguage.CFamily:
                        string sqLanguage;
                        string json = CFamily.TryGetConfig(logger, tracker.ProjectItem, path, out sqLanguage);
                        if (json != null && sqLanguage != null)
                        {
                            daemon.RequestAnalysis(path, charset, sqLanguage, json, this);
                        }
                        break;

                    default:
                        break;
                    }
                }

                logger.WriteLine($"Unsupported content type for {path}");
            }
        }