Example #1
0
 internal void Parse(ITextSnapshot snapshot, out LanguageService.SyntaxTree.ITokenStream TokenStream, string path)
 {
     string source = snapshot.GetText();
     // Currently we "eat" all Exception that might be raised
     // by XSharpSyntaxTree.ParseText
     TokenStream = null;
     try
     {
         LanguageService.CodeAnalysis.SyntaxTree tree = XSharpSyntaxTree.ParseText(source, null, path);
         var syntaxRoot = tree.GetRoot();
         // Get the antlr4 parse tree root
         var xtree = ((LanguageService.CodeAnalysis.XSharp.Syntax.CompilationUnitSyntax)syntaxRoot).XSource;
         TokenStream = ((LanguageService.CodeAnalysis.XSharp.Syntax.CompilationUnitSyntax)syntaxRoot).XTokenStream;
         //
         var walker = new LanguageService.SyntaxTree.Tree.ParseTreeWalker();
         var discover = new XSharpTreeDiscover();
         discover.Snapshot = snapshot;
         discover.xsharpBraceCloseType = xsharpBraceCloseType;
         discover.xsharpBraceOpenType = xsharpBraceOpenType;
         discover.xsharpIdentifierType = xsharpIdentifierType;
         discover.xsharpRegionStartType = xsharpRegionStartType;
         discover.xsharpRegionStopType = xsharpRegionStopType;
         // Walk the tree. The TreeDiscover class will collect the tags.
         walker.Walk(discover, xtree);
         this.tags = discover.tags;
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine(e.Message);
     }
 }
        public LanguageServiceTests()
        {
            this.workspace = new Workspace();

            this.powerShellContext = new PowerShellContext();
            this.languageService = new LanguageService(this.powerShellContext);
        }
        /// <summary>
        /// Constructs the Freshbooks API authentication and wrapper class
        /// </summary>
        /// <param name="accountName">The account name for which you are trying to access</param>
        /// <param name="consumerKey">The developer's freshbooks account name</param>
        /// <param name="oauthSecret">The developer's oauth-secret provided by freshbooks</param>
        public FreshbooksApi(string accountName, string consumerKey, string oauthSecret)
        {
            _accountName = accountName;
            _consumerKey = consumerKey;
            _oauthSecret = oauthSecret ?? String.Empty;

            _baseUri = new UriBuilder { Scheme = "https", Host = accountName + ".freshbooks.com" }.Uri;
            _serviceUri = new Uri(_baseUri, "/api/2.1/xml-in");
            Clear();

            UserAgent = String.Format("{0}/{1} ({2})", 
                GetType().Name,
                GetType().Assembly.GetName().Version.ToString(2), 
                GetType().Assembly.FullName);

            Callback = new CallbackService(new ServiceProxy(this, "callback"));
            Category = new CategoryService(new ServiceProxy(this, "category"));
            Client = new ClientService(new ServiceProxy(this, "client"));
            Estimate = new EstimateService(new ServiceProxy(this, "estimate"));
            Expense = new ExpenseService(new ServiceProxy(this, "expense"));
            Gateway = new GatewayService(new ServiceProxy(this, "gateway"));
            Invoice = new InvoiceService(new ServiceProxy(this, "invoice"));
            Item = new ItemService(new ServiceProxy(this, "item"));
            Language = new LanguageService(new ServiceProxy(this, "language"));
            Payment = new PaymentService(new ServiceProxy(this, "payment"));
            Project = new ProjectService(new ServiceProxy(this, "project"));
            Recurring = new RecurringService(new ServiceProxy(this, "recurring"));
            System = new SystemService(new ServiceProxy(this, "system"));
            Staff = new StaffService(new ServiceProxy(this, "staff"));
            Task = new TaskService(new ServiceProxy(this, "task"));
            Tax = new TaxService(new ServiceProxy(this, "tax"));
            TimeEntry = new TimeEntryService(new ServiceProxy(this, "time_entry"));
        }
Example #4
0
 public ViewFilter(LanguageService service, Source source, IVsTextView view) {
   this.service = service;
   this.source = source;
   this.textView = view;     
   view.AddCommandFilter(this, out nextTarget);
   this.IID_IVsTextViewEvents = typeof(IVsTextViewEvents).GUID;
   this.cookie = VsShell.Connect(view, this, ref IID_IVsTextViewEvents);
 }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ILanguageService Service1 = new LanguageService(new LanguageRepository(new HotelsEntities())); 

            var query = Service1.Query;
            var list = query.Execute().ToList();
            Response.Write(list.Count);
        }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RefactorRenameAdapter"/> class.
 /// </summary>
 /// <param name="serviceProvider">The <see cref="IServiceProvider"/> instance.</param>
 public RefactorRenameAdapter(IServiceProvider serviceProvider)
 {
     provider = serviceProvider;
     dte = provider.GetService(typeof (DTE)) as DTE;
     languageService = provider.GetService(typeof (ILuaLanguageService)) as LanguageService;
     refactoringService = provider.GetService(typeof (IRefactoringService)) as IRefactoringService;
     luaUndoService = provider.GetService(typeof (ILuaUndoService)) as ILuaUndoService;
 }
Example #7
0
 /// <summary>
 /// Creates LuaCommandFilter singleton instance.
 /// </summary>
 /// <param name="languageService">The language service.</param>
 /// <returns></returns>
 public static LuaCommandFilter GetCommandFilter(LanguageService languageService)
 {
     lock (syncLock)
     {
         if (commandFilter == null)
             commandFilter = new LuaCommandFilter(languageService);
         return commandFilter;
     }
 }
 public TypeScriptService(Project project)
 {
     NodeLanguageServiceHost.NodeCommandLocator = () => PropertyService.Get<string> ("TypeScriptBinding.NodeLocation");
     this.project = project;
     ShimHost = new TypeScriptLS ();
     var ls = new TypeScriptServicesFactory ()
         .CreatePullLanguageService (new LanguageServiceShimHostAdapter (ShimHost));
     LanguageService = new LanguageService (ls.Instance);
 }
Example #9
0
        /// <summary>
        /// Initializes a new instance of the CodeOutlineCache class.
        /// </summary>
        /// <param name="control">The SourceOutlinerControl.</param>
        /// <param name="dte">A DTE object exposing the Visual Studio automation object model.</param>
        /// <param name="languageService">The Lua LanguageService.</param>
        public CodeOutlineCache(SourceOutlinerControl control, DTE dte, LanguageService languageService)
        {
            Debug.Assert(control != null);
            Debug.Assert(dte != null);

            this.languageService = languageService;
            this.control = control;
            this.dte = dte;

            // Initialize the events.
            AdviseCodeModelEvents();
        }
 public static ILanguageService<Language> GetJobSeekerLanguage()
 {
     ILanguageService<SkillSmart.Dto.Language> serviceObj = null;
     switch (sectionHandler.ConnectionStringName)
     {
         case DataBaseType.SKILLSMART_MONGO_DB: serviceObj = new LanguageService(DatabaseFactory.CreateMongoDatabase());
             break;
         default: serviceObj = new LanguageService(DatabaseFactory.CreateMongoDatabase());
             break;
     }
     return serviceObj;
 }
Example #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BasePackage"/> class.
        /// </summary>
        /// <!-- Failed to insert some or all of included XML -->
        /// <include file="doc\Package.uex" path="docs/doc[@for=&quot;Package.Package&quot;]"/>
        /// <devdoc>
        /// Simple constructor.
        /// </devdoc>
        protected BasePackage()
        {
            var callback = new ServiceCreatorCallback(
                delegate(IServiceContainer container, Type serviceType)
                {
                    if (typeof(LanguageService) == serviceType)
                    {
                        var language = new LanguageService();
                        language.SetSite(this);

                        // register for idle time callbacks
                        var mgr = GetService(typeof(SOleComponentManager)) as IOleComponentManager;
                        if (componentID == 0 && mgr != null)
                        {
                            OLECRINFO[] crinfo = new OLECRINFO[1];
                            crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO));
                            crinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime |
                                               (uint)_OLECRF.olecrfNeedPeriodicIdleTime;
                            crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal |
                                                 (uint)_OLECADVF.olecadvfRedrawOff |
                                                 (uint)_OLECADVF.olecadvfWarningsOff;
                            crinfo[0].uIdleTimeInterval = 1000;
                            int hr = mgr.FRegisterComponent(this, crinfo, out componentID);
                        }

                        return language;
                    }
                    else
                    {
                        return null;
                    }
                });

            // proffer the LanguageService
            (this as IServiceContainer).AddService(typeof(LanguageService), callback, true);
        }
 public MySource(LanguageService service,
                 IVsTextLines textLines,
                 Colorizer colorizer)
     : base(service, textLines, colorizer)
 {
 }
Example #13
0
 /// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.OnSynchronizeDropdowns"]/*' />
 /// <summary>
 /// This method is called to update the drop down bars to match the current contents of the text editor window.
 /// It is called during OnIdle when the caret position changes.  You can provide new drop down members here.
 /// It is up to you to sort the ArrayLists if you want them sorted in any particular order.
 /// </summary>
 /// <param name="languageService">The language service</param>
 /// <param name="textView">The editor window</param>
 /// <param name="line">The line on which the cursor is now positioned</param>
 /// <param name="col">The column on which the cursor is now position</param>
 /// <param name="dropDownTypes">The current list of types (you can update this)</param>
 /// <param name="dropDownMembers">The current list of members (you can update this)</param>
 /// <param name="selectedType">The selected type (you can update this)</param>
 /// <param name="selectedMember">The selected member (you can update this)</param>
 /// <returns>true if something was updated</returns>
 public abstract bool OnSynchronizeDropdowns(LanguageService languageService, IVsTextView textView, int line, int col, ArrayList dropDownTypes, ArrayList dropDownMembers, ref int selectedType, ref int selectedMember);
Example #14
0
        private string FindBTCPayServerDirectory()
        {
            var solutionDirectory = LanguageService.TryGetSolutionDirectoryInfo(Directory.GetCurrentDirectory());

            return(Path.Combine(solutionDirectory.FullName, "BTCPayServer"));
        }
        // [Fact]
        public async void GetDefinitionFromProcedures()
        {
            string queryString = "EXEC master.dbo.sp_MSrepl_startup";

            // place the cursor on every token

            //cursor on objects
            TextDocumentPosition fnDocument = CreateTextDocPositionWithCursor(30, TestUri);

            //cursor on sys
            TextDocumentPosition dboDocument = CreateTextDocPositionWithCursor(14, TestUri);

            //cursor on master
            TextDocumentPosition masterDocument = CreateTextDocPositionWithCursor(10, TestUri);

            LiveConnectionHelper.TestConnectionResult connectionResult = LiveConnectionHelper.InitLiveConnectionInfo(null, TestUri);
            ScriptFile     scriptFile = connectionResult.ScriptFile;
            ConnectionInfo connInfo   = connectionResult.ConnectionInfo;

            connInfo.RemoveAllConnections();
            var bindingQueue = new ConnectedBindingQueue();

            bindingQueue.AddConnectionContext(connInfo);
            scriptFile.Contents = queryString;

            var service = new LanguageService();

            service.RemoveScriptParseInfo(OwnerUri);
            service.BindingQueue = bindingQueue;
            await service.UpdateLanguageServiceOnConnection(connectionResult.ConnectionInfo);

            Thread.Sleep(2000);

            ScriptParseInfo scriptInfo = new ScriptParseInfo {
                IsConnected = true
            };

            service.ParseAndBind(scriptFile, connInfo);
            scriptInfo.ConnectionKey = bindingQueue.AddConnectionContext(connInfo);
            service.ScriptParseInfoMap.Add(TestUri, scriptInfo);

            // When I call the language service
            var fnResult     = service.GetDefinition(fnDocument, scriptFile, connInfo);
            var sysResult    = service.GetDefinition(dboDocument, scriptFile, connInfo);
            var masterResult = service.GetDefinition(masterDocument, scriptFile, connInfo);

            // Then I expect the results to be non-null
            Assert.NotNull(fnResult);
            Assert.NotNull(sysResult);
            Assert.NotNull(masterResult);

            // And I expect the all results to be the same
            Assert.True(CompareLocations(fnResult.Locations, sysResult.Locations));
            Assert.True(CompareLocations(fnResult.Locations, masterResult.Locations));

            Cleanup(fnResult.Locations);
            Cleanup(sysResult.Locations);
            Cleanup(masterResult.Locations);
            service.ScriptParseInfoMap.Remove(TestUri);
            connInfo.RemoveAllConnections();
        }
 /// <summary>
 /// Constructor for entity type template service.
 /// </summary>
 /// <param name="fileService">Template file service.</param>
 /// <param name="languageService">Template language service.</param>
 public FakeHbsEntityTypeTemplateService(ITemplateFileService fileService,
                                         ITemplateLanguageService languageService) : base(fileService, languageService)
 {
     EntitiesTemplateFiles = LanguageService.GetEntitiesTemplateFileInfo(fileService);
 }
Example #17
0
 public TypeAndMemberDropdownBars(LanguageService languageService){
   this.languageService = languageService;
 }
Example #18
0
        /// <summary>
        /// Initializes a new instance of the CodeOutlineFileManager class.
        /// </summary>
        /// <param name="control">The outline control object.</param>
        /// <param name="dte">A DTE object exposing the Visual Studio automation object model.</param>
        /// <param name="d">The source file Document.</param>
        /// <param name="toolWindow">The tool window for the package.</param>
        /// <param name="languageService">The Lua LanguageService.</param>
        public CodeOutlineFileManager(SourceOutlinerControl control, DTE dte,
            Document d, SourceOutlineToolWindow toolWindow, LanguageService languageService)
        {
            this.languageService = languageService;
            this.control = control;
            this.dte = dte;
            sourceOutlineToolWindow = toolWindow;
            viewType = ViewType.TreeView;
            searchCriteria = new SearchCriteria(CodeElementType.All);
            currentFilterText = "";
            currentDocument = d;

            codeTreeView = new TreeView();
            codeFilterView = new TreeView();

            //
            // codeTreeView
            //
            codeTreeView.Dock = DockStyle.Fill;
            codeTreeView.HideSelection = false;
            codeTreeView.Location = new Point(0, 45);
            codeTreeView.Name = "codeTreeView";
            codeTreeView.ShowNodeToolTips = true;
            codeTreeView.Size = new Size(352, 294);
            codeTreeView.TabIndex = 2;

            //
            // codeFilterView
            //
            codeFilterView.Dock = DockStyle.Fill;
            codeFilterView.HideSelection = false;
            codeFilterView.Location = new Point(0, 45);
            codeFilterView.Name = "codeFilterView";
            codeFilterView.ShowNodeToolTips = true;
            codeFilterView.Size = new Size(352, 294);
            codeFilterView.TabIndex = 3;
            codeFilterView.Visible = false;
            codeFilterView.ShowLines = false;
            codeFilterView.ShowRootLines = false;
            codeFilterView.FullRowSelect = true;
        }
Example #19
0
 public AdaSource(LanguageService service, IVsTextLines textLines, Colorizer colorizer)
     : base(service, textLines, colorizer)
 {
 }
Example #20
0
 public ExcessSource(LanguageService service, IVsTextLines textLines, Colorizer colorizer, VisualStudioWorkspace workspace, DocumentId id) :
     base(service, textLines, colorizer)
 {
     _workspace = workspace;
     _id        = id;
 }
Example #21
0
 public TextOptionImportPageViewModelBuilder(FieldDefinitionService fieldDefinitionService, LanguageService languageService)
 {
     _fieldDefinitionService = fieldDefinitionService;
     _languageService        = languageService;
 }
 public void HandleSignatureHelpRequestDisabled()
 {
     InitializeTestObjects();
     WorkspaceService <SqlToolsSettings> .Instance.CurrentSettings.SqlTools.IntelliSense.EnableIntellisense = false;
     Assert.NotNull(LanguageService.HandleSignatureHelpRequest(null, null));
 }
Example #23
0
 public AuthoringScope(LanguageService languageService, AuthoringHelper helper)
   : base(languageService, helper){
   ErrorHandler errorHandler = new ErrorHandler(new ErrorNodeList(0));
   this.typeSystem = new TypeSystem(errorHandler);
   this.resolver = new Resolver(errorHandler, this.typeSystem);
 }
Example #24
0
 public CodeWindowManager(LanguageService service, IVsCodeWindow codeWindow, Source source) {
   this.service = service;
   this.codeWindow = codeWindow;
   this.viewFilters = new ArrayList();
   this.source = source;
 }
Example #25
0
 public AuthoringScope(LanguageService languageService, AuthoringHelper helper){
   this.languageService = languageService;
   this.helper = helper;
 }
Example #26
0
 public TypeAndMemberDropdownBars(LanguageService languageService, GlyphProvider glyphProvider) 
   : base(languageService){
   this.scTypeAndMemberDropdownBars = new System.Compiler.TypeAndMemberDropdownBars(languageService.scLanguageService);
   this.glyphProvider = glyphProvider;
 }
        public MessageBoxResult Show(string msgText, MessageBoxButton button)
        {
            var res = Show(msgText, LanguageService.FindResourceString(Constants.WindowTitle_Tip), button);

            return(res);
        }
Example #28
0
 protected override void OnEditFieldDescriptorDisplayName(FieldInfo fieldInfo, EditingValueEventArgs <string> args)
 {
     args.Value = LanguageService.FindResourceString($"{Constants.ExtSuperBlockFieldPrefix}{fieldInfo.Name}");
 }
Example #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LuaCommandFilter"/> class.
 /// </summary>
 /// <param name="languageService">The Lua LanguageService.</param>
 public LuaCommandFilter(LanguageService languageService)
 {
     this.languageService = languageService;
 }
 public LanguagesController(IMemoryCache memoryCache, SeedService seedService, LanguageService languageService) :
     base(memoryCache, seedService) => this.languageService = languageService;
Example #31
0
 public LanguagePickerViewModel(IAnalyticsService analyticsService, INavigationHelper navigationHelper, LanguageService languageService)
     : base(analyticsService)
 {
     this.languageService = languageService;
     LanguageService.PreferredLanguageChanged += LanguageService_PreferredLanguageChanged;
     SetAppLanguageCommand = new AsyncCommand <LanguageViewModel>((x) => SetAppLanguage(x));
 }
Example #32
0
 public CanvasDocumentPane(Views.CanvasPresenter canvas)
 {
     Header  = LanguageService.FindResourceString(DocumentPaneHeader_Canvas);
     _canvas = canvas;
 }
Example #33
0
        public ScheduleService(IHttpReportsStorage storage, IOptions <DashboardOptions> options, LanguageService languageService)
        {
            _storage = storage;

            _options = options.Value;

            scheduler = scheduler ?? new StdSchedulerFactory().GetScheduler().Result;
        }
 public DashboardHandle(IServiceProvider serviceProvider, IHttpReportsStorage storage, IOptions <DashboardOptions> options, LanguageService language) : base(serviceProvider)
 {
     _storage  = storage;
     _options  = options;
     _language = language;
 }
        public async Task HandleRequestToChangeToSqlcmdFile()
        {
            var scriptFile = new ScriptFile()
            {
                ClientFilePath = "HandleRequestToChangeToSqlcmdFile_" + DateTime.Now.ToLongDateString() + "_.sql"
            };

            try
            {
                // Prepare a script file
                scriptFile.SetFileContents("koko wants a bananas");
                File.WriteAllText(scriptFile.ClientFilePath, scriptFile.Contents);

                // Create a workspace and add file to it so that its found for intellense building
                var workspace        = new ServiceLayer.Workspace.Workspace();
                var workspaceService = new WorkspaceService <SqlToolsSettings> {
                    Workspace = workspace
                };
                var langService = new LanguageService()
                {
                    WorkspaceServiceInstance = workspaceService
                };
                langService.CurrentWorkspace.GetFile(scriptFile.ClientFilePath);
                langService.CurrentWorkspaceSettings.SqlTools.IntelliSense.EnableIntellisense = true;

                // Add a connection to ensure the intellisense building works
                ConnectionInfo connectionInfo = GetLiveAutoCompleteTestObjects().ConnectionInfo;
                langService.ConnectionServiceInstance.OwnerToConnectionMap.Add(scriptFile.ClientFilePath, connectionInfo);

                // Test SQL
                int countOfValidationCalls = 0;
                var eventContextSql        = new Mock <SqlTools.Hosting.Protocol.EventContext>();
                eventContextSql.Setup(x => x.SendEvent(PublishDiagnosticsNotification.Type, It.Is <PublishDiagnosticsNotification>((notif) => ValidateNotification(notif, 2, ref countOfValidationCalls)))).Returns(Task.FromResult(new object()));
                await langService.HandleDidChangeLanguageFlavorNotification(new LanguageFlavorChangeParams
                {
                    Uri      = scriptFile.ClientFilePath,
                    Language = LanguageService.SQL_LANG.ToLower(),
                    Flavor   = "MSSQL"
                }, eventContextSql.Object);

                await langService.DelayedDiagnosticsTask; // to ensure completion and validation before moveing to next step

                // Test SQL CMD
                var eventContextSqlCmd = new Mock <SqlTools.Hosting.Protocol.EventContext>();
                eventContextSqlCmd.Setup(x => x.SendEvent(PublishDiagnosticsNotification.Type, It.Is <PublishDiagnosticsNotification>((notif) => ValidateNotification(notif, 0, ref countOfValidationCalls)))).Returns(Task.FromResult(new object()));
                await langService.HandleDidChangeLanguageFlavorNotification(new LanguageFlavorChangeParams
                {
                    Uri      = scriptFile.ClientFilePath,
                    Language = LanguageService.SQL_CMD_LANG.ToLower(),
                    Flavor   = "MSSQL"
                }, eventContextSqlCmd.Object);

                await langService.DelayedDiagnosticsTask;

                Assert.True(countOfValidationCalls == 2, $"Validation should be called 2 time but is called {countOfValidationCalls} times");
            }
            finally
            {
                if (File.Exists(scriptFile.ClientFilePath))
                {
                    File.Delete(scriptFile.ClientFilePath);
                }
            }
        }
 public MessageBoxResult Show(string msg)
 {
     return(Show(msg, LanguageService.FindResourceString(Constants.WindowTitle_Tip), MessageBoxButton.OK));
 }
Example #37
0
        public FrmResult(List <ModifiedCodeFile> files, AnalyzeService analyzeService, LanguageService languageService)
        {
            InitializeComponent();

            _files           = files;
            _analyzeService  = analyzeService;
            _languageService = languageService;
        }
 /// <summary>
 /// Default constructor.
 /// </summary>
 public LanguageApiController(LanguageService service, ManagerLocalizer localizer)
 {
     _service   = service;
     _localizer = localizer;
 }
Example #39
0
 public void SetStatusText(string text)         // implemetn IIdeProject
 {
     LanguageService.SetStatusBarText(text);
     Debug.WriteLine(text);
 }
        public void GetDefinitionTimeoutTest()
        {
            // Given a binding queue that will automatically time out
            var languageService = new LanguageService();
            Mock <ConnectedBindingQueue> queueMock = new Mock <ConnectedBindingQueue>();

            languageService.BindingQueue = queueMock.Object;
            ManualResetEvent mre      = new ManualResetEvent(true); // Do not block
            Mock <QueueItem> itemMock = new Mock <QueueItem>();

            itemMock.Setup(i => i.ItemProcessed).Returns(mre);

            DefinitionResult timeoutResult = null;

            queueMock.Setup(q => q.QueueBindingOperation(
                                It.IsAny <string>(),
                                It.IsAny <Func <IBindingContext, CancellationToken, object> >(),
                                It.IsAny <Func <IBindingContext, object> >(),
                                It.IsAny <int?>(),
                                It.IsAny <int?>()))
            .Callback <string, Func <IBindingContext, CancellationToken, object>, Func <IBindingContext, object>, int?, int?>(
                (key, bindOperation, timeoutOperation, t1, t2) =>
            {
                timeoutResult          = (DefinitionResult)timeoutOperation((IBindingContext)null);
                itemMock.Object.Result = timeoutResult;
            })
            .Returns(() => itemMock.Object);

            TextDocumentPosition textDocument = new TextDocumentPosition
            {
                TextDocument = new TextDocumentIdentifier {
                    Uri = OwnerUri
                },
                Position = new Position
                {
                    Line      = 0,
                    Character = 20
                }
            };

            LiveConnectionHelper.TestConnectionResult connectionResult = LiveConnectionHelper.InitLiveConnectionInfo();
            ScriptFile     scriptFile = connectionResult.ScriptFile;
            ConnectionInfo connInfo   = connectionResult.ConnectionInfo;

            scriptFile.Contents = "select * from dbo.func ()";

            ScriptParseInfo scriptInfo = new ScriptParseInfo {
                IsConnected = true
            };

            languageService.ScriptParseInfoMap.Add(OwnerUri, scriptInfo);

            // When I call the language service
            var result = languageService.GetDefinition(textDocument, scriptFile, connInfo);

            // Then I expect null locations and an error to be reported
            Assert.NotNull(result);
            Assert.True(result.IsErrorResult);
            // Check timeout message
            Assert.Equal(SR.PeekDefinitionTimedoutError, result.Message);
        }
Example #41
0
        private void Refresh(bool isNavigationIntercepted)
        {
            var locationPath = NavigationManager.ToBaseRelativePath(_locationAbsolute);

            locationPath = StringUntilAny(locationPath, _queryOrHashStartChar);


            // Custom
            if (string.IsNullOrWhiteSpace(locationPath))
            {
                locationPath = LanguageService.GetDefaultLanguage().TwoLetterCode;
            }


            var context = new RouteContext(locationPath);

            Routes.Route(context);

            // Custom - Not valid route
            if (context.Handler == null || !LanguageService.HasValidLanguageInUrl(locationPath))
            {
                context = SetErrorContext(locationPath);
            }


            if (context.Handler != null)
            {
                if (!typeof(IComponent).IsAssignableFrom(context.Handler))
                {
                    throw new InvalidOperationException($"The type {context.Handler.FullName} " +
                                                        $"does not implement {typeof(IComponent).FullName}.");
                }

                Log.NavigatingToComponent(_logger, context.Handler, locationPath, _baseUri);

                //Custom - Adding language param if missing, also set default language
                if (!context.Parameters.ContainsKey("Language"))
                {
                    context.Parameters.Add("Language", LanguageService.GetDefaultLanguage().TwoLetterCode.ToString());
                }

                //Custom - Has nu language, set default language
                if (string.IsNullOrWhiteSpace(context.Parameters["Language"].ToString()))
                {
                    context.Parameters["Language"] = LanguageService.GetDefaultLanguage().TwoLetterCode.ToString();
                }

                //Custom - Set the language CascadingParameter
                ContextStateProvider.RouteLanguage = context.Parameters["Language"].ToString();

                RouteData routeData = new RouteData(
                    context.Handler,
                    context.Parameters ?? _emptyParametersDictionary);


                _renderHandle.Render(Found(routeData));
            }
            else
            {
                if (!isNavigationIntercepted)
                {
                    Log.DisplayingNotFound(_logger, locationPath, _baseUri);

                    // We did not find a Component that matches the route.
                    // Only show the NotFound content if the application developer programatically got us here i.e we did not
                    // intercept the navigation. In all other cases, force a browser navigation since this could be non-Blazor content.
                    _renderHandle.Render(NotFound);
                }
                else
                {
                    Log.NavigatingToExternalUri(_logger, _locationAbsolute, locationPath, _baseUri);
                    NavigationManager.NavigateTo(_locationAbsolute, forceLoad: true);
                }
            }
        }
 public GreenFieldInvoiceController(InvoiceController invoiceController, InvoiceRepository invoiceRepository, LinkGenerator linkGenerator, LanguageService languageService)
 {
     _invoiceController = invoiceController;
     _invoiceRepository = invoiceRepository;
     _linkGenerator     = linkGenerator;
     LanguageService    = languageService;
 }
Example #43
0
 public Skill(LanguageService languageService, FavDialog favDialog, Accessor accessor)
 {
     _accessor        = accessor;
     _languageService = languageService;
     _favDialog       = favDialog;
 }
Example #44
0
 /// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.TypeAndMemberDropdownBars"]/*' />
 protected TypeAndMemberDropdownBars(LanguageService languageService)
 {
     this.languageService = languageService;
     this.dropDownTypes   = new ArrayList();
     this.dropDownMembers = new ArrayList();
 }
Example #45
0
 public virtual void CloseColorizer()
 {
     this.languageService = null;
     this.buffer          = null;
 }
Example #46
0
 public ProbeDropDownHelper(LanguageService ls)
     : base(ls)
 {
 }
Example #47
0
    public Source(LanguageService service, IVsTextLines textLines, Colorizer colorizer) {
      this.service = service;
      this.textLines = textLines;
      this.colorizer = colorizer;
      this.taskProvider = new TaskProvider(service.site); // task list
      this.completionSet = this.GetCompletionSet();      
      this.methodData = this.GetMethodData();
      this.colorState = (IVsTextColorState)textLines;

      Guid statusBarGuid = typeof(VsShellInterop.IVsStatusbar).GUID;
      this.statusBar = (VsShellInterop.IVsStatusbar)service.site.QueryService(statusBarGuid, typeof(VsShellInterop.IVsStatusbar));

      service.GetCommentFormat(ref commentInfo);

      // track source changes
      if (service.Preferences.EnableCodeSenseFastOnLineChange) {
        textChangeCommitEventsCookie = VsShell.Connect( textLines, (IVsFinalTextChangeCommitEvents)this, ref VsConstants.IID_IVsFinalTextChangeCommitEvents);
      }
      this.textLinesEventsCookie = VsShell.Connect( textLines, (IVsTextLinesEvents)this, ref VsConstants.IID_IVsTextLinesEvents);

    }
Example #48
0
 public TranslateCommand(LanguageService languageSrv, string help)
     : base(help)
 {
     _languageSrv = languageSrv;
 }
Example #49
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public XmlLanguageService(LanguageService languageService)
 {
     this.languageService = (VSXmlLanguageService)languageService;
 }
        /// <summary>
        /// 编辑GPT设备的Stoken;
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="name"></param>
        /// <param name="xElem"></param>
        /// <param name="reporter"></param>
        /// <returns></returns>
        private static void EditStokenOnGpt(DeviceStoken deviceStoken, IUnmanagedBasicDeviceManager entity)
        {
            if (deviceStoken == null)
            {
                throw new ArgumentNullException(nameof(deviceStoken));
            }

            var gptDeviceInfo = new GPTDeviceInfo();

            try {
                deviceStoken.TypeGuid  = Constants.DeviceType_GPT;
                deviceStoken.PartsType = Constants.PartsType_GPT;

                //获取GPT链表;
                var partPtr        = Partition_Get_GptPTable(entity.BasicDevicePtr);
                var partNode       = partPtr;
                var infoDiskIndex  = 0;
                var efiInfoIndex   = 0;
                var efiPTableIndex = 0;

                while (partNode != IntPtr.Zero)
                {
                    var gptPTable   = partNode.GetStructure <StGptPTable>();
                    var gptPartInfo = new GPTPartInfo {
                        StGptPTable = gptPTable
                    };

                    if (gptPTable.InfoDisk != IntPtr.Zero)
                    {
                        var stInfoDisk = gptPTable.InfoDisk.GetStructure <StInFoDisk>();
                        gptPartInfo.InfoDisk = new InfoDisk(stInfoDisk)
                        {
                            InternalDisplayName = $"{LanguageService.FindResourceString(Constants.DisplayName_InfoDisk)}{++infoDiskIndex}"
                        };
                    }

                    if (gptPTable.EFIInfo != IntPtr.Zero)
                    {
                        var stEFIInfo = gptPTable.EFIInfo.GetStructure <StEFIInfo>();
                        gptPartInfo.EFIInfo = new EFIInfo(stEFIInfo)
                        {
                            InternalDisplayName = $"{LanguageService.FindResourceString(Constants.DisplayName_EFIInfo)}{++efiInfoIndex}"
                        };
                    }

                    if (gptPTable.EFIPTable != IntPtr.Zero)
                    {
                        var stEFITable = gptPTable.EFIPTable.GetStructure <StEFIPTable>();
                        gptPartInfo.EFIPTable = new EFIPTable(stEFITable)
                        {
                            InternalDisplayName = $"{LanguageService.FindResourceString(Constants.DisplayName_EFIPTable)}{++efiPTableIndex}"
                        };
                    }

                    gptDeviceInfo.GptPartInfos.Add(gptPartInfo);
                    partNode = gptPTable.next;
                }

                EditGptPartEntries(gptDeviceInfo, deviceStoken);

                //编辑拓展;
                deviceStoken.SetInstance(gptDeviceInfo, Constants.DeviceStokenTag_GPTDeviceInfo);
            }
            catch (Exception ex) {
                LoggerService.WriteCallerLine(ex.Message);
            }
        }
Example #51
0
 public CodeWindowManager(LanguageService service, IVsCodeWindow codeWindow, Source source, GlyphProvider glyphProvider)
   : base(service, codeWindow, source){
   this.glyphProvider = glyphProvider;
 }
Example #52
0
    public void Close() {
      if (this.textLinesEventsCookie != 0) 
        VsShell.DisConnect(this.textLines, ref VsConstants.IID_IVsTextLinesEvents, this.textLinesEventsCookie );
      if (this.textChangeCommitEventsCookie != 0) 
        VsShell.DisConnect( this.textLines, ref VsConstants.IID_IVsFinalTextChangeCommitEvents, this.textChangeCommitEventsCookie );

      this.statusBar = null;
      this.methodData.Close();
      this.methodData = null;
      this.completionSet.Close();
      this.completionSet = null;
      this.taskProvider.Close();
      this.taskProvider = null;
      this.service = null;
      this.colorizer = null;      
    }
Example #53
0
 public FoxProScope(Module module, LanguageService language)
 {
     this.module   = module;
     this.language = language;
 }