Exemplo n.º 1
0
        public FileModel(FileId id, ITextBuffer textBuffer, ServerModel server, Dispatcher dispatcher, IVsHierarchy hierarchy, string fullPath)
        {
            Hierarchy   = hierarchy;
            FullPath    = fullPath;
            Ext         = Path.GetExtension(fullPath).ToLowerInvariant();
            Id          = id;
            Server      = server;
            _textBuffer = textBuffer;

            var snapshot = textBuffer.CurrentSnapshot;
            var empty    = new CompilerMessage[0];

            CompilerMessages          = new CompilerMessage[KindCount][] { empty, empty, empty };
            CompilerMessagesSnapshots = new ITextSnapshot[KindCount] {
                snapshot, snapshot, snapshot
            };
            _errorListProviders = new ErrorListProvider[KindCount] {
                null, null, null
            };

            server.Client.ResponseMap[id] = msg => dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                                                          new Action <AsyncServerMessage>(msg2 => Response(msg2)), msg);

            server.Add(this);

            textBuffer.Changed += TextBuffer_Changed;
        }
Exemplo n.º 2
0
        public FileModel(FileId id, ITextBuffer textBuffer, ServerModel server, Dispatcher dispatcher, IVsHierarchy hierarchy, string fullPath)
        {
            Hierarchy   = hierarchy ?? throw new ArgumentNullException(nameof(hierarchy));
            FullPath    = fullPath ?? throw new ArgumentNullException(nameof(fullPath));
            Ext         = Path.GetExtension(fullPath).ToLowerInvariant();
            Id          = id;
            Server      = server ?? throw new ArgumentNullException(nameof(server));
            _dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
            _textBuffer = textBuffer ?? throw new ArgumentNullException(nameof(textBuffer));

            var snapshot = textBuffer.CurrentSnapshot;
            var empty    = new CompilerMessage[0];

            CompilerMessages          = new CompilerMessage[KindCount][] { empty, empty, empty };
            CompilerMessagesSnapshots = new ITextSnapshot[KindCount] {
                snapshot, snapshot, snapshot
            };

            UpdateResponseMap(id, server, dispatcher);

            server.Add(this);

            textBuffer.Changed += TextBuffer_Changed;
        }