示例#1
0
        private PythonTextBufferInfo(PythonEditorServices services, ITextBuffer buffer)
        {
            Services    = services;
            Buffer      = buffer;
            _eventSinks = new ConcurrentDictionary <object, IPythonTextBufferInfoEventSink>();
            _filename   = new Lazy <string>(GetOrCreateFilename);
            _bufferId   = -1;

            ITextDocument doc;

            if (Buffer.Properties.TryGetProperty(typeof(ITextDocument), out doc))
            {
                Document = doc;
                Document.EncodingChanged += Document_EncodingChanged;
            }
            Buffer.ContentTypeChanged += Buffer_ContentTypeChanged;
            Buffer.Changed            += Buffer_TextContentChanged;
            Buffer.ChangedLowPriority += Buffer_TextContentChangedLowPriority;
        }
示例#2
0
        private PythonTextBufferInfo(PythonEditorServices services, ITextBuffer buffer)
        {
            Services                = services;
            Buffer                  = buffer;
            _eventSinks             = new ConcurrentDictionary <object, IPythonTextBufferInfoEventSink>();
            _filename               = new Lazy <string>(GetOrCreateFilename);
            _documentUri            = new Lazy <Uri>(GetOrCreateDocumentUri);
            _tokenCache             = new TokenCache();
            _defaultLanguageVersion = PythonLanguageVersion.None;

            ITextDocument doc;

            if (Buffer.Properties.TryGetProperty(typeof(ITextDocument), out doc))
            {
                Document = doc;
                Document.EncodingChanged += Document_EncodingChanged;
            }
            Buffer.ContentTypeChanged += Buffer_ContentTypeChanged;
            Buffer.Changed            += Buffer_TextContentChanged;
            Buffer.ChangedLowPriority += Buffer_TextContentChangedLowPriority;

            if (Buffer is ITextBuffer2 buffer2)
            {
                _hasChangedOnBackground      = true;
                buffer2.ChangedOnBackground += Buffer_TextContentChangedOnBackground;
            }

            _locationTracker = new LocationTracker(Buffer.CurrentSnapshot);

#if BUFFERINFO_TRACING
            _traceLog = new AnalysisLogWriter(
                PathUtils.GetAvailableFilename(System.IO.Path.GetTempPath(), "PythonTools_Buffer_{0}_{1:yyyyMMddHHmmss}".FormatInvariant(PathUtils.GetFileOrDirectoryName(_filename.Value), DateTime.Now), ".log"),
                false,
                false,
                cacheSize: 1
                );
#endif
        }
示例#3
0
 public BraceMatcher(PythonEditorServices editorServices, ITextView view)
 {
     _textView       = view;
     _editorServices = editorServices;
 }
 public ReplWindowCreationListener([Import] PythonEditorServices editorServices)
 {
     _editorServices = editorServices;
 }