示例#1
0
 private void InvalidateReferencingModules(IPsiModule psiModule)
 {
     using (CompilationContextCookie.GetOrCreate(psiModule.GetContextFromModule()))
     {
         var resolveContext = CompilationContextCookie.GetContext();
         foreach (var psiModuleReference in PsiModules.GetReverseModuleReferences(psiModule, resolveContext))
         {
             if (myPsiModules.TryGetValue(psiModuleReference.Module, out var moduleSymbols))
             {
                 moduleSymbols.Invalidate();
             }
         }
     }
 }
        private void InvalidateReferencingModules(IPsiModule psiModule)
        {
            if (PsiModulesCaches.IsEmpty())
            {
                return;
            }

            // todo: reuse FcsProjectProvider references
            using (CompilationContextCookie.GetOrCreate(psiModule.GetContextFromModule()))
            {
                var resolveContext = CompilationContextCookie.GetContext();
                foreach (var psiModuleReference in PsiModules.GetReverseModuleReferences(psiModule, resolveContext))
                {
                    if (PsiModulesCaches.TryGetValue(psiModuleReference.Module, out var moduleSymbols))
                    {
                        moduleSymbols.Invalidate();
                    }
                }
            }
        }
 public ISymbolScope GetDeclarationsCache(IPsiModule psiModule, bool withReferences, bool caseSensitive)
 {
     return this._cache.GetSymbolScope(LibrarySymbolScope.FULL, caseSensitive, psiModule.GetContextFromModule());
 }
示例#4
0
 public ISymbolScope GetDeclarationsCache(IPsiModule psiModule, bool withReferences, bool caseSensitive)
 {
     return(this._cache.GetSymbolScope(LibrarySymbolScope.FULL, caseSensitive, psiModule.GetContextFromModule()));
 }
 private IDeclaredType GetVoidType(IPsiModule module)
 {
     return(module.GetPredefinedType(module.GetContextFromModule()).Void);
 }
示例#6
0
        public void Execute(Action <DaemonStageResult> action)
        {
            List <HighlightingInfo> highlightings = new List <HighlightingInfo>();

            IPsiModule module = _file.GetPsiModule();

            ResXSettings settings = _settingsStore.GetKey <ResXSettings>(SettingsOptimization.OptimizeDefault);

            IAttributesSet             moduleAttributes = _file.GetSolution().GetPsiServices().Symbols.GetModuleAttributes(module, module.GetContextFromModule());
            string                     defaultResXDic   = "en-US";
            IList <IAttributeInstance> attributes       = moduleAttributes
                                                          .GetAttributeInstances(new ClrTypeName(typeof(NeutralResourcesLanguageAttribute).FullName), false);

            if (attributes != null &&
                attributes.Count > 0 &&
                attributes[0].PositionParameter(0).ConstantValue.Value != null)
            {
                defaultResXDic = attributes[0].PositionParameter(0).ConstantValue.Value.ToString();
            }

            ISpellChecker checker = SpellCheckManager.GetSpellChecker(_settingsStore, _file, defaultResXDic);

            if (checker != null)
            {
                foreach (IXmlToken token in getStringsToCheck())
                {
                    WordLexer lexer = new WordLexer(token.GetText());
                    lexer.Start();
                    while (lexer.TokenType != null)
                    {
                        if (SpellCheckUtil.ShouldSpellCheck(lexer.TokenText, settings.CompiledWordsToIgnore) &&
                            !checker.TestWord(lexer.TokenText, false))
                        {
                            DocumentRange docRange  = token.GetDocumentRange();
                            TextRange     textRange = new TextRange(docRange.TextRange.StartOffset + lexer.TokenStart,
                                                                    docRange.TextRange.StartOffset + lexer.TokenEnd);
                            DocumentRange range = new DocumentRange(docRange.Document, textRange);

                            ResXSpellHighlighting highlighting =
                                new ResXSpellHighlighting(lexer.TokenText, _file, checker, range, _settingsStore);

                            highlightings.Add(new HighlightingInfo(range, highlighting));
                        }
                        lexer.Advance();
                    }
                }
            }
            action(new DaemonStageResult(highlightings.ToArray()));
        }