示例#1
0
        public override void Initialize(LSPDocumentManager documentManager)
        {
            if (documentManager is null)
            {
                throw new ArgumentNullException(nameof(documentManager));
            }

            documentManager.Changed += DocumentManager_Changed;
        }
        public DefaultFormattingOptionsProvider(
            LSPDocumentManager documentManager,
            IIndentationManagerService indentationManagerService)
        {
            if (documentManager is null)
            {
                throw new ArgumentNullException(nameof(documentManager));
            }

            if (indentationManagerService is null)
            {
                throw new ArgumentNullException(nameof(indentationManagerService));
            }

            _documentManager           = documentManager;
            _indentationManagerService = indentationManagerService;
        }
示例#3
0
        public static bool TryGetDocument(this LSPDocumentManager documentManager, string filePath, out LSPDocumentSnapshot lspDocumentSnapshot)
        {
            if (documentManager is null)
            {
                throw new ArgumentNullException(nameof(documentManager));
            }

            if (filePath is null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            if (filePath.StartsWith("/", StringComparison.Ordinal) && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                filePath = filePath.Substring(1);
            }

            var uri = new Uri(filePath, UriKind.Absolute);

            return(documentManager.TryGetDocument(uri, out lspDocumentSnapshot));
        }