public CodeParser(ITextBuffer buffer, ITranslationKeysProvider keysProvider) { _buffer = buffer; _buffer.ChangedLowPriority += BufferChanged; _keysProvider = keysProvider; _keysProvider.KeysUpdated += KeysUpdated; _translationKeys = _keysProvider.GetKeys(); }
public ICodeParser GetCodeParser(ITextBuffer buffer, ITranslationKeysProvider keysProvider) { IDictionary<ITextBuffer, ICodeParser> parsers; lock (_lockObject) { if (!_parsers.ContainsKey(buffer)) { var newParser = new CodeParser(buffer, keysProvider); _parsers.Add(buffer, newParser); } parsers = _parsers; } return parsers[buffer]; }