예제 #1
0
 /// <include file='doc\ExpansionProvider.uex' path='docs/doc[@for="ExpansionProvider.Dispose"]/*' />
 public virtual void Dispose() {
     EndTemplateEditing(true);
     this.source = null;
     this.vsExpansion = null;
     this.view = null;
     GC.SuppressFinalize(this);
 }
예제 #2
0
 /// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.CodeWindowManager"]/*' />
 /// <summary>
 /// The CodeWindowManager is constructed by the base LanguageService class when VS calls
 /// the IVsLanguageInfo.GetCodeWindowManager method.  You can override CreateCodeWindowManager
 /// on your LanguageService if you want to plug in a different CodeWindowManager.
 /// </summary>
 public CodeWindowManager(LanguageService service, IVsCodeWindow codeWindow, Source source) {
     this.service = service;
     this.codeWindow = codeWindow;
     this.viewFilters = new ArrayList();
     this.source = source;
     this.properties = service.CreateDocumentProperties(this);
 }
예제 #3
0
 public BooScope(LanguageService service, CompiledDocument compiledDocument, Source source, string fileName)
 {
     this.service = service;
     this.compiledDocument = compiledDocument;
     this.source = source;
     this.fileName = fileName;
 }
예제 #4
0
        public BlenXAuthoringScope(Babel.Parser.Parser parser, Babel.Source source)
        {
            this.parser = parser;
             this.source = source;

             // how should this be set?
             this.resolver = new Babel.Resolver();
        }
예제 #5
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);
 }
예제 #6
0
 /// <summary>
 /// Reformat the text buffer
 /// </summary>
 private void FormatBuffer(Microsoft.VisualStudio.Package.Source src)
 {
     using (var edits = new EditArray(src, null, false, "Reformat"))
     {
         var span = src.GetDocumentSpan();
         src.ReformatSpan(edits, span);
     }
 }
예제 #7
0
 /// <include file='doc\ViewFilter.uex' path='docs/doc[@for="ViewFilter.ViewFilter"]/*' />
 public ViewFilter(CodeWindowManager mgr, IVsTextView view) {
     this.pvaChar = IntPtr.Zero;
     this.mgr = mgr;
     this.service = mgr.LanguageService;
     this.source = mgr.Source;
     this.commentSupported = this.service.Preferences.EnableCommenting;
     this.textView = view;
     NativeMethods.ThrowOnFailure(view.AddCommandFilter(this, out nextTarget));
     this.textViewEvents = new NativeMethods.ConnectionPointCookie(view, this, typeof(IVsTextViewEvents));
 }
예제 #8
0
 /// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.Close"]/*' />
 /// <summary>Closes all view filters, and the document properties window</summary>
 public void Close() {
     Trace.WriteLine("CodeWindowManager::Close");
     if (this.properties != null) this.properties.Close();
     CloseFilters();
     this.viewFilters = null;
     properties = null;
     service = null;
     source = null;
     this.codeWindow = null;
 }
예제 #9
0
 /// <include file='doc\EditArray.uex' path='docs/doc[@for="EditArray.EditArray1"]/*' />
 /// <summary>
 /// This constructor takes a view and will use CompoundViewAction to make the updates
 /// and it will update the current selection accordingly.
 /// <param name="source">The buffer to operate on</param>
 /// <param name="view">The text view to use for CompoundViewAction and whose selection you want updated</param>
 /// <param name="merge">Whether to attempt to merge edits</param>
 /// <param name="description">Name used in compound action</param>
 /// </summary>
 public EditArray(Source source, IVsTextView view, bool merge, string description)
 {
     this.source = source;
     this.editList = new ArrayList();
     this.merge = merge;
     this.description = description;
     if (view != null) {
         TextSpan[] pSpan = new TextSpan[1];
         view.GetSelectionSpan(pSpan);
         this.selection = pSpan[0];
         this.view = view;
     }
     this.ca = CompoundActionFactory.GetCompoundAction(this.view, this.source, description);
     this.ca.FlushEditActions();
     // Sanity check - make sure others are not modifying the buffer while the
     // caller is preparing the big edit operation.
     this.changeCount = source.ChangeCount;
 }
예제 #10
0
        /// <include file='doc\ExpansionProvider.uex' path='docs/doc[@for="ExpansionProvider.ExpansionProvider"]/*' />
        public ExpansionProvider(Source src) {
            if (src == null){
                throw new ArgumentNullException("src");
            }
            this.fieldDefaults = new ArrayList();
            if (src == null)
                throw new System.ArgumentNullException();

            this.source = src;
            this.vsExpansion = null; // do we need a Close() method here?

            // QI for IVsExpansion
            IVsTextLines buffer = src.GetTextLines();
            this.vsExpansion = (IVsExpansion)buffer;
            if (this.vsExpansion == null) {
                throw new ArgumentNullException("(IVsExpansion)src.GetTextLines()");
            }
        }
예제 #11
0
    public virtual void RemoveAdornments() {

      if (dropDownHelper != null) {
        IVsDropdownBarManager dbm =(IVsDropdownBarManager)this.codeWindow;
        dbm.RemoveDropdownBar();
        dropDownHelper.Done();
        dropDownHelper = null;
      }

      foreach (ViewFilter f in this.viewFilters) {
        f.Close();
      }
      this.viewFilters.Clear();

      this.service.CloseSource(this.source);
      this.source = null;

      service.RemoveCodeWindowManager(this);
      this.codeWindow = null;
      GC.Collect();
    }
예제 #12
0
        /// <include file='doc\Utilities.uex' path='docs/doc[@for="TextSpanHelper.ValidCoord"]/*' />
        public static bool ValidCoord(Source src, int line, int pos)
        {
            // validate line
            if (line < 0) {
                Debug.Assert(false, "line < 0");
                return false;
            }

            // validate index
            if (pos < 0) {
                Debug.Assert(false, "pos < 0");
                return false;
            }

            if (src != null) {
                int lineCount = src.GetLineCount();
                if (line >= lineCount) {
                    Debug.Assert(false, "line > linecount");
                    return false;
                }

                int lineLength = src.GetLineLength(line);
                if (pos > lineLength) {
                    Debug.Assert(false, "pos > linelength");
                    return false;
                }

            }
            return true;
        }
예제 #13
0
        private bool GetSource(IOleServiceProvider docViewService)
        {
            Guid languageServiceGuid;
            this.textEditorBuffer.GetLanguageServiceID(out languageServiceGuid);
            if (languageServiceGuid != VisualStudioDocument.xmlLanguageServiceGuid)
            {
                return false;
            }

            //IOleServiceProvider docViewService = (IOleServiceProvider)docViewServiceObject;
            IntPtr ptr;
            Guid guid = VisualStudioDocument.xmlLanguageServiceGuid;
            Guid iid = typeof(IVsLanguageInfo).GUID;
            if (!ErrorHandler.Succeeded(docViewService.QueryService(ref guid, ref iid, out ptr)))
            {
                return false;
            }

            this.currentDocumentLanguageInfo = (IVsLanguageInfo)Marshal.GetObjectForIUnknown(ptr);
            Marshal.Release(ptr);

            LanguageService langsvc = this.currentDocumentLanguageInfo as LanguageService;
            this.currentSource = langsvc.GetSource(this.textEditorBuffer);
            return true;
        }
예제 #14
0
 public static CompoundActionBase GetCompoundAction(IVsTextView view, Source src, string description)
 {
     if (view != null) {
         return new CompoundViewAction(view, description);
     } else if (src != null) {
         return new CompoundAction(src, description);
     } else {
         throw new ArgumentNullException("Either view or src is expected to be non null");
     }
 }
예제 #15
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.GetCodeWindowManagerForSource"]/*' />
 public CodeWindowManager GetCodeWindowManagerForSource(Source src) {
     if (src == null) return null;
     foreach (CodeWindowManager m in this.codeWindowManagers) {
         if (m.Source == src) {
             return m;
         }
     }
     return null;
 }
예제 #16
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.CreateParseRequest"]/*' />
 public virtual ParseRequest CreateParseRequest(Source s, int line, int idx, TokenInfo info, string sourceText, string fname, ParseReason reason, IVsTextView view) {
     this.isParsing = false; // yes, "false".  It get's set to true in the actual background thread.
     return new ParseRequest(line, idx, info, sourceText, fname, reason, view, s.CreateAuthoringSink(reason, line, idx));
 }
예제 #17
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.CreateExpansionProvider"]/*' />
 public virtual ExpansionProvider CreateExpansionProvider(Source src) {
     return new ExpansionProvider(src);
 }
예제 #18
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.CreateCodeWindowManager"]/*' />
 public virtual CodeWindowManager CreateCodeWindowManager(IVsCodeWindow codeWindow, Source source) {
     return new CodeWindowManager(this, codeWindow, source);
 }
예제 #19
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.OnCloseSource"]/*' />
 public virtual void OnCloseSource(Source source) {
     ClearTask();
     if (this.sources != null) {
         if (this.sources.Contains(source)) {
             this.sources.Remove(source);
         }
     }
 }
예제 #20
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.IsSourceOpen"]/*' />
 public virtual bool IsSourceOpen(Source src) {
     return (this.sources != null) && this.sources.Contains(src);
 }
예제 #21
0
        // This method simulates what VS does in debug mode so that we can catch the
        // errors in managed code before they go to the native debug assert.
        /// <include file='doc\Utilities.uex' path='docs/doc[@for="TextSpanHelper.ValidSpan"]/*' />
        public static bool ValidSpan(Source src, TextSpan span)
        {
            if (!ValidCoord(src, span.iStartLine, span.iStartIndex))
                return false;

            if (!ValidCoord(src, span.iEndLine, span.iEndIndex))
                return false;

            // end must be >= start
            if (!TextSpanHelper.IsPositive(span))
                return false;

            return true;
        }
예제 #22
0
 private static CMakeItemDeclarations CreateSetPropertyDeclarations(
     CMakeCommandId id, ParseRequest req, Source source,
     List<string> priorParameters)
 {
     CMakeItemDeclarations decls = null;
     int propertyIndex = priorParameters.IndexOf("PROPERTY");
     if (propertyIndex < 0)
     {
         CMakePropertyType type = CMakeProperties.GetPropertyTypeFromKeyword(
             priorParameters[0]);
         if (_propObjMethods.ContainsKey(type) &&
             !priorParameters.Any(x => _setPropertyKeywords.Contains(x)))
         {
             decls = _propObjMethods[type](id, req, source, priorParameters);
         }
         else
         {
             decls = new CMakeItemDeclarations();
         }
         if (priorParameters.Count > 1 || type == CMakePropertyType.Global)
         {
             decls.AddItems(_setPropertyKeywords,
                 CMakeItemDeclarations.ItemType.Command);
         }
         decls.ExcludeItems(priorParameters.Skip(1));
     }
     else if (propertyIndex == priorParameters.Count - 1)
     {
         CMakePropertyType type = CMakeProperties.GetPropertyTypeFromKeyword(
             priorParameters[0]);
         IEnumerable<string> properties = CMakeProperties.GetPropertiesOfType(
             type);
         decls = new CMakeItemDeclarations();
         decls.AddItems(properties, CMakeItemDeclarations.ItemType.Property);
     }
     return decls;
 }
예제 #23
0
파일: Source.cs 프로젝트: Xtremrules/dot42
 /// <summary>
 /// Default ctor
 /// </summary>
 public Source(Microsoft.VisualStudio.Package.Source source)
 {
     this.source = source;
 }
예제 #24
0
 /// <summary>
 /// Reformat the text buffer
 /// </summary>
 void FormatBuffer(Source src)
 {
     using (EditArray edits = new EditArray(src, null, false, Resources.ReformatBuffer))
     {
         TextSpan span = src.GetDocumentSpan();
         src.ReformatSpan(edits, span);
     }
 }
예제 #25
0
 /// <summary>
 /// Create a declarations object.
 /// </summary>
 /// <param name="id">The CMake command for which to create the object.</param>
 /// <param name="req">The parse request for which to create the object.</param>
 /// <param name="source">The CMake source file.</param>
 /// <param name="priorParameters">
 /// List of parameters appearing prior to the parameters that triggered the
 /// parse request, if it was triggered by whitespace, or null otherwise.
 /// </param>
 /// <returns>The newly created declarations object.</returns>
 public static CMakeItemDeclarations CreateDeclarations(CMakeCommandId id,
     ParseRequest req, Source source, List<string> priorParameters = null)
 {
     Dictionary<CMakeCommandId, FactoryMethod> map =
         priorParameters == null ? _methods : _wsMethods;
     if (!map.ContainsKey(id))
     {
         return null;
     }
     return map[id](id, req, source, priorParameters);
 }
예제 #26
0
 private static CMakeItemDeclarations CreateCMakeHostSystemInformationDeclarations(
     CMakeCommandId id, ParseRequest req, Source source,
     List<string> priorParameters)
 {
     if (priorParameters.Count != 3 || priorParameters[2] != "QUERY")
     {
         return null;
     }
     CMakeItemDeclarations decls = new CMakeItemDeclarations();
     decls.AddItems(_cmakeHostSystemInformationKeys,
         CMakeItemDeclarations.ItemType.Command);
     return decls;
 }
예제 #27
0
 private static CMakeItemDeclarations CreateGetFileNameComponentDeclarations(
     CMakeCommandId id, ParseRequest req, Source source,
     List<string> priorParameters)
 {
     if (priorParameters.Count != 2)
     {
         return null;
     }
     CMakeItemDeclarations decls = new CMakeItemDeclarations();
     decls.AddItems(_getFileNameComponentComponents,
         CMakeItemDeclarations.ItemType.Command);
     return decls;
 }
예제 #28
0
 internal NemerleCompletionSet(ImageList imageList, Source source)
     : base(imageList, source)
 {
 }
예제 #29
0
 public override Microsoft.VisualStudio.Package.CodeWindowManager GetCodeWindowManager(
     Microsoft.VisualStudio.Package.LanguageService languageService, Microsoft.VisualStudio.TextManager.Interop.IVsCodeWindow codeWindow,
     Microsoft.VisualStudio.Package.Source source)
 {
     return(new CodeWindowManager((LanguageService)languageService, codeWindow, source, glyphProvider));
 }
예제 #30
0
        public void PrepareParse(TextSpan programLoc, Source source)
        {
            _source = (HLSLSource)source;
            _source.PrepareParse(programLoc);
            tempCurScope = _source.programScope;

            tempMembers = new List<HLSLDeclaration>();
            tempFunctionVars = new Dictionary<string, VarDecl>();
            forLoopVars = new Dictionary<TextSpan, KeyValuePair<TextSpan, LexValue>>();

            //programScope = new CodeScope(programLoc);
            //tempCurScope = programScope;
        }
예제 #31
0
        /// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.RemoveAdornments"]/*' />
        /// <summary>Remove drop down combos, view filters, and notify the LanguageService that the Source and
        /// CodeWindowManager is now closed</summary>
        public virtual int RemoveAdornments()
        {
            #if	LANGTRACE
            Trace.WriteLine("CodeWindowManager::RemoveAdornments");
            #endif
            try {
                if (this.dropDownHelper != null) {
                    IVsDropdownBarManager dbm = (IVsDropdownBarManager)this.codeWindow;
                    NativeMethods.ThrowOnFailure(dbm.RemoveDropdownBar());
                    this.dropDownHelper.Done();
                    this.dropDownHelper = null;
                }
            } finally {
                CloseFilters();

                if (this.source != null && this.source.Close()) {
                    this.service.OnCloseSource(this.source);
                    this.source.Dispose();
                }
                this.source = null;

                service.RemoveCodeWindowManager(this);
                this.codeWindow = null;
                this.Close();
            }
            return NativeMethods.S_OK;
        }
예제 #32
0
파일: Source.cs 프로젝트: hesam/SketchSharp
 public CompletionSet(ImageList ilist, Source source) {
   this.imageList = ilist;
   this.source = source;
 }
예제 #33
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public Source(Microsoft.VisualStudio.Package.Source source)
 {
     this.source = source;
 }