added some development tools
[windows-sources.git] / developer / VSSDK / VisualStudioIntegration / Common / IDL / singlefileeditor.idl
blob95a1378da3fd8806ed145cb49e790856e5dfb076
1 ////////////////////////////////////////////////////////////////////////////////
2 // SingleFileEditor.idl
3 //
4 // Interfaces for single file ASPX editing in Venus
5 //
6 // NOTE: These interfaces are currently stored in this single IDL file. This
7 // is most likely *NOT* how we want them permenantly.
8 //
9 ////////////////////////////////////////////////////////////////////////////////
11 #ifndef INTEROPLIB
13 import "oaidl.idl";
14 import "oleidl.idl";
15 import "textmgr.idl";
16 import "textmgr2.idl";
17 import "vsshell.idl";
19 #endif
21 #include "textmgruuids.h"
23 interface IVsContainedLanguage;
24 interface IVsWebFormDesignerSupport;
25 interface IVsEnumCodeBlocks;
26 interface IVsContainedCode;
27 interface IVsContainedLanguageFactory;
28 interface IVsTextBufferCoordinator;
29 interface IVsContainedLanguageHost;
30 interface IVsContainedLanguageHostEvents;
31 interface IVsReportExternalErrors;
32 interface IVsEnumExternalErrors;
33 coclass VsTextBufferCoordinator;
34 coclass VsIntellisenseCompletor;
35 coclass VsIntellisenseLangTip;
37 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
38 // Represents a pairing of two textspans. Used to express corrisponding pairs in two seperate buffers
39 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
40 typedef struct _TEXTSPANPAIR
42 TextSpan span1;
43 TextSpan span2;
44 } TextSpanPair;
46 typedef struct _TEXTSPANANDCOOKIE
49 ULONG ulHTMLCookie; //html needs to handle nuggets like <%foo%> <%foo%> at the same line
50 TextSpan CodeSpan; //Code textspan between line paragma
51 } TextSpanAndCookie;
53 enum IntellisenseHostFlags
55 IHF_READONLYCONTEXT = 0x00000001, // Context buffer is read-only (REVIEW: Would be nice to have some enforcement of this...)
56 IHF_NOSEPARATESUBJECT = 0x00000002, // No subject text -- context buffer contains intellisense-target (implies !IHF_READONLYCONTEXT)
57 IHF_SINGLELINESUBJECT = 0x00000004, // Subject text is not multi-line capable
58 IHF_FORCECOMMITTOCONTEXT = 0x00000008, // == to CanCommitIntoReadOnlyBuffer, *really* need to rethink this name
59 IHF_OVERTYPE = 0x00000010 // editing (in subject or context) should be done in overtype mode
62 typedef enum _CODEMEMBERTYPE
64 CODEMEMBERTYPE_EVENTS = 0x00000001,
65 CODEMEMBERTYPE_EVENT_HANDLERS = 0x00000002,
66 CODEMEMBERTYPE_USER_FUNCTIONS = 0x00000004
67 } CODEMEMBERTYPE;
69 enum ContainedLanguageRefreshMode
71 CLRM_COMPILEFILE = 1, // Recompile the file - gets called when primary editor replaces the entire buffer and wants full recompile
72 CLRM_COMPILEPROJECT = 2, // Recompile entire project (say, when compiler options have changed)
75 typedef enum _CONTAINEDLANGUAGERENAMETYPE
77 CLRT_CLASS,
78 CLRT_CLASSMEMBER,
79 CLRT_NAMESPACE,
80 CLRT_OTHER
81 } ContainedLanguageRenameType;
84 #ifndef INTEROPLIB
86 uuid(14F5E18F-4A4C-456d-A140-639BC7C2E80D),
87 version(1.0)
89 library SingleFileEditor
92 #endif
94 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
95 // Implemented by clients (including IVsTextView) to provide intellisense hosting functionality
96 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
97 [ uuid(0377986B-C450-453c-A7BE-67116C9129A6) ]
98 interface IVsIntellisenseHost : IOleCommandTarget
100 // Host flags (see IntellisenseHostFlags enum above)
101 HRESULT GetHostFlags([out, retval] DWORD *pdwFlags);
103 // The context buffer
104 HRESULT GetContextBuffer([out, retval] IVsTextLines **ppCtxBuffer);
106 // The "focal point" or position in the context buffer that should be considered the starting context point
107 HRESULT GetContextFocalPoint([out] TextSpan *pSpan, long *piLen);
109 // Caret/selection setting relative to the context buffer. (Any editing should be done via the buffer)
110 HRESULT SetContextCaretPos([in] long iLine, [in] long iIndex);
111 HRESULT GetContextCaretPos([out] long *piLine, [out] long *piIndex);
112 HRESULT SetContextSelection([in] long iStartLine, [in] long iStartIndex, [in] long iEndLine, [in] long iEndIndex);
113 HRESULT GetContextSelection([out] TextSpan *pSelectionSpan); // Returns ??? if selection is a box?
115 // Subject text -- the text upon which intellisense should operate. Returns E_NOTIMPL if GetHostFlags()
116 // includes IHF_NOSEPARATESUBJECT; the contents of the context buffer should be considered the subject text.
117 HRESULT GetSubjectText([out, retval] BSTR *pbstrSubjectText);
119 // Caret/selection management for subject text (all return E_NOTIMPL if IHF_NOSEPARATESUBJECT is set in flags)
120 HRESULT SetSubjectCaretPos([in] long iIndex);
121 HRESULT GetSubjectCaretPos([out] long *piIndex);
122 HRESULT SetSubjectSelection([in] long iAnchorIndex, [in] long iEndIndex);
123 HRESULT GetSubjectSelection([out] long *piAnchorIndex, [out] long *piEndIndex);
125 // Editing subject text. Will return E_FAIL (or something) if text contains CR/LF's and flags
126 // contain IHF_SINGLELINESUBJECT.
127 HRESULT ReplaceSubjectTextSpan([in] long iStartIndex, [in] long iEndIndex, [in] LPCWSTR pszText);
129 // Intellisense UI handling
130 HRESULT UpdateCompletionStatus([in] IVsCompletionSet *pCompSet, [in] DWORD dwFlags);
131 HRESULT UpdateTipWindow([in] IVsTipWindow *pTipWindow, [in] DWORD dwFlags);
132 HRESULT HighlightMatchingBrace([in] DWORD dwFlags, [in] ULONG cSpans, [in, size_is(cSpans)] TextSpan *rgBaseSpans);
134 HRESULT BeforeCompletorCommit();
135 HRESULT AfterCompletorCommit();
137 HRESULT GetServiceProvider([out]IServiceProvider **ppSP);
138 HRESULT GetHostWindow([out] HWND *hwnd);
139 HRESULT GetContextLocation([in]long iPos, [in]long iLen, [in] BOOL fUseCaretPosition, [out]RECT *prc, [out]long *piTopX);
140 HRESULT UpdateSmartTagWindow([in]IVsSmartTagTipWindow *pSmartTagWnd, [in] DWORD dwFlags);
141 HRESULT GetSmartTagRect([out]RECT *rcSmartTag);
145 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
146 // Core editor provided intellisense host for standard editor views
147 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
148 [ uuid(0816A38B-2B41-4d2a-B1FF-23C1E28D8A18) ]
149 interface IVsTextViewIntellisenseHost : IVsIntellisenseHost
151 // NOTE: it seems that since the primary buffer will have the nugget text as the user is typing,
152 // then all this object needs to know is the span in the primary buffer. Needs thought...
153 // NOTE: If above is true, can an empty span be used when the user first types in nugget?
154 // NOTE: Yes, I realize this name is stupid...
155 HRESULT SetSubjectFromPrimaryBuffer(TextSpan *pSpanInPrimary);
158 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
159 // Implemented by a text view which provides IVsTextViewIntellisenseHost
160 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
161 [uuid (2E758295-344B-48d6-86AC-BD81F89CB4B8) ]
162 interface IVsTextViewIntellisenseHostProvider : IUnknown
164 // If pBufferCoordinator is NULL, the returned host is simply a pass-through directly to this view.
165 HRESULT CreateIntellisenseHost([in] IVsTextBufferCoordinator *pBufferCoordinator, [in] REFIID riid, [out, iid_is(riid)] void **ppunkHost);
168 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
169 // VsIntellisenseCompletor coclass
170 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
172 uuid(F2073DB0-75B9-43ae-8681-0962C0CD4BE2),
173 helpstring("VsTextBufferCoordinator Class")
175 coclass VsIntellisenseCompletor
177 interface IVsIntellisenseCompletor;
180 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
181 // IVsIntellisenseCompleter is used to create and display a completor window
182 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
183 [uuid (05DFCF7A-C78A-4e20-AAFB-4A0F4D26E0FB)]
184 interface IVsIntellisenseCompletor : IOleCommandTarget
186 HRESULT Initialize(IVsIntellisenseHost *pHost, HWND hwndParent);
187 HRESULT Update(IVsCompletionSet *pCompSet, DWORD dwFlags);
188 HRESULT GetWidth(DWORD *dwWidth);
189 HRESULT GetHeight(DWORD *dwHeight);
190 HRESULT GetCompletionSpan(TextSpan *ts);
191 HRESULT SetLocation(POINT *p);
192 HRESULT Hide();
193 HRESULT IsActive([out] BOOL *pfIsActive);
194 HRESULT GetWindowHandle([out] HWND *phwnd);
197 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
198 // VsIntellisenseLangTip coclass
199 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
201 uuid(39F4B568-7166-42b3-87E6-6B856864AE55),
202 helpstring("VsIntellisenseLangTip Class")
204 coclass VsIntellisenseLangTip
206 interface IVsIntellisenseLangTip;
209 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
210 // IVsIntellisenseLangTip
212 // This interface is used to expose the method tips (CLangTip class).
213 // THe CProxyLangTip class implements this interface. Most calls are simply delegated to the actual CLangTip
214 // (instance of which is created in this proxy class).
215 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
216 [uuid (1E34D422-7120-4d9e-96FF-E880B665D30D)]
217 interface IVsIntellisenseLangTip : IUnknown
219 HRESULT Initialize ([in] IVsIntellisenseHost *pHost);
220 HRESULT GetSizePreferences ([in] RECT *prcCtxBounds, [in] TIPSIZEDATA *pSizeData);
221 HRESULT Create ([in] IVsTipWindow *pTipWnd);
222 HRESULT Update ([in] IVsTipWindow *pTipWnd, [in] DWORD dwFlags);
223 HRESULT UpdatePosition ();
224 HRESULT GetSizeY ([out]short *pSizeY);
225 HRESULT Close ([in] BOOL fDeleteThis);
226 HRESULT IsActive ([out]BOOL* pfIsActive);
227 HRESULT GetOverloadCount ([out] long *plOverloadCount);
228 HRESULT ScrollUp ();
229 HRESULT ScrollDown ();
232 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
233 // Implemented by the editor that uses contained languages
234 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
236 [uuid (0429916F-69E1-4336-AB7E-72086FB0D6BC) ]
237 interface IVsContainedLanguageHost: IUnknown
239 HRESULT Advise([in] IVsContainedLanguageHostEvents* pHost, [out] VSCOOKIE* pvsCookie);
240 HRESULT Unadvise([in] VSCOOKIE vsCookie);
242 // Secondary language should call this during pretty listing, document
243 // fomatting, event handler generation, etc in order to obtain information
244 // on the base indent level and indent settings (tabs, spaces, etc) of
245 // the primary language service.
247 // Base indent level is the indent level of the containing (parent) block:
249 // <script language="vb" runat="server">
250 // Sub Foo()
251 // Dim x as String
252 // End Sub
253 // </script>
255 // Base indent is the indent of the <script> block.
256 // Line number is number of the line in the secondary buffer.
257 // If host decides to derive the indent form file, pbstrIndentString provides the exact indent string.
258 // plParentIndentLevel then does not have any meaning.
259 // If host is not able to derive indent from file, it should return NULL as pbstrIndentString
260 // and then the contained language should use value in the plParentIndentLevel.
261 HRESULT GetLineIndent([in] long lLineNumber, [out] BSTR* pbstrIndentString, [out] long* plParentIndentLevel, [out] long* plIndentSize, [out] BOOL* pfTabs, [out] long* plTabSize);
263 // Host may need to suppress reformatting such as pretty listing when there are no span mappings
264 // established yet between primary and secondary buffers (say, a new server script block is
265 // just being inserted and hasn't been compiled yet so the host hasn't yet called
266 // IVsContainedCode::EnumOriginalCodeBlocks.
267 HRESULT CanReformatCode([out] BOOL* pfCanReformat);
269 // If contained language is not able to figure out where to create a marker for compile error
270 // so it is visible to the user, the contained language service should call host so host can
271 // provide closest item to create marker on. Example:
273 // <script runat=server language=vb>
274 // Sub Foo()
275 // </script>
277 // Normally VB squggles the End Class statement or whatever follows the missing End Sub.
278 // However, in ASP.NET case all this text is outside the visible range (outside
279 // of the #external source - #end external source block). The secondary language
280 // can figure this out by calling IVsTextBufferCoordinator::MapSecondaryToPrimary which
281 // will fail.
283 // The squggle should appear on the </script> tag. That is what the host returns:
284 // statement nearest to the requested line.
285 HRESULT GetNearestVisibleToken([in] TextSpan tsSecondaryToken, [out] TextSpan* ptsPrimaryToken);
287 // Ensures that span in the primary buffer is visible. If host is in a view
288 // that does not show the span, it must switch to the view where the span is visible.
289 // For instance, if HTML editor is in Design view, it should switch to HTML (source) view.
290 // If it is in Code Only view and the requested span is not visible, then the editor
291 // should switch to the HTML view.
292 // This method should be called by the secondary language when it needs to navigate
293 // to the code when user double-click on an item in the task list.
294 HRESULT EnsureSpanVisible([in] TextSpan tsPrimary);
296 // Returns S_OK if it is OK to modify secondary buffer, BUFFER_E_SCC_READONLY otherwise.
297 HRESULT QueryEditFile();
299 // Notification from ContainedLanguage that a rename of the specified type was initiated.
300 // bstrOldID and bstrNewID are fully qualified.
301 HRESULT OnRenamed([in] ContainedLanguageRenameType clrt, [in] BSTR bstrOldID, [in] BSTR bstrNewID);
303 // Requests from contained language to insert markup. The full type is the dot
304 // delimited namespace and object that you wish to insert markup.
305 HRESULT InsertControl( [in]const WCHAR * pwcFullType, [in]const WCHAR * pwcID );
307 // Add an assembly that is currently in the GAC. The string looks something like:
308 // "system,version=1.0.0.1,culture=neutral,publickeytoken=9b35aa32c8d4fb1"
309 HRESULT InsertReference( [in]const WCHAR * );
311 // Returns IVsHierarchy and ITEMID for the primary text buffer. Useful to return from IVsErrorItem::GetProject
312 // since secondary buffer does not have associated IVsHierarchy and hence compiler is not able to implement
313 // IVsErrorItem correctly when working as a contained language.
314 HRESULT GetVSHierarchy([out] IVsHierarchy** ppVsHierarchy);
315 HRESULT GetErrorProviderInformation([out] BSTR* pbstrTaskProviderName, [out] GUID* pguidTaskProviderGuid);
317 // The string is the namespace for an <%@ import asp tag.
318 HRESULT InsertImportsDirective( [in]const WCHAR * );
320 // If contained language changes its editor settings (specifically, colors), there is no way for the host
321 // to get the event from the Core IDE. Therefore, contained language must notify the host when it changes
322 // Fonts and Colors setting
323 HRESULT OnContainedLanguageEditorSettingsChange();
325 // If code generation is in progress (which means secondary buffer content is stale),
326 // the call will block until secondary buffer is generated. If language service needs
327 // buffer to be in ready state and doesn't want it to be updated in the middle of the action,
328 // it should call this method. However, be careful not to block UI too much.
329 HRESULT EnsureSecondaryBufferReady();
332 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
333 // Must be implemented by the secondary language in order to receive host events
334 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
335 [uuid (F2A52136-803E-4cef-BBA7-52D610FE34BA) ]
336 interface IVsContainedLanguageHostEvents: IUnknown
338 // Signals that the view has changed. Flag tells if the new view is text-based.
339 HRESULT OnViewChange([in] BOOL fTextView);
342 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
343 // Implemented by a language to provide simplistic contained language service features
344 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
346 // E_CONTAINEDLANGUAGE_CANNOTFINDITEM is a custom HRESULT, meaning the name passed to
347 // IVsContainedLanguage::OnRenamed couldn't be found in order to be renamed by the contained language.
348 cpp_quote ("#define E_CONTAINEDLANGUAGE_CANNOTFINDITEM MAKE_HRESULT(1, FACILITY_ITF, 0x8003)")
350 // E_CONTAINEDLANGUAGE_RENAMECANCELLED is a custom HRESULT, meaning that the user cancelled the rename
351 // operation.
352 cpp_quote ("#define E_CONTAINEDLANGUAGE_RENAMECANCELLED MAKE_HRESULT(1, FACILITY_ITF, 0x8004)")
355 [ uuid(518ab114-e3c6-4bbc-a469-99279f1a54e9) ]
356 interface IVsContainedLanguage : IUnknown
358 // Sets host of the secondary language. NULL pointer is acceptable.
359 // If the interface is NULL the secondary language should release
360 // the cached host interface pointer.
361 HRESULT SetHost([in] IVsContainedLanguageHost* pHost);
363 // returns a colorizer object for the language
364 HRESULT GetColorizer([out, retval] IVsColorizer **ppColorizer);
366 // returns a text view filter to handle delegated text view filtering responsibility. The full text view is passed in
367 HRESULT GetTextViewFilter([in] IVsIntellisenseHost* pISenseHost, [in] IOleCommandTarget *pNextCmdTarget, [out, retval] IVsTextViewFilter **pTextViewFilter);
369 // returns the GUID for the contained language’s full language service
370 HRESULT GetLanguageServiceID ([out] GUID *pguidLangService);
372 // Allows to change coordinators on the fly
373 HRESULT SetBufferCoordinator([in] IVsTextBufferCoordinator* pBC);
375 // See ContainedLanguageRefreshMode enum
376 HRESULT Refresh([in] DWORD dwRefreshMode);
378 // Called to ensure the contained language is ready
379 HRESULT WaitForReadyState();
383 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
384 // Implemented by a language to provide colorization for line fragments
385 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
386 [ uuid(88105779-D75B-459e-B7AD-78F63BD40714) ]
387 interface IVsContainedLanguageColorizer : IUnknown
389 HRESULT ColorizeLineFragment([in] long iLine,
390 [in] long iIndex,
391 [in] long iLength,
392 [in] const WCHAR *pszText,
393 [in] long iState,
394 [out] ULONG * pAttributes,
395 [out] long *piNewState);
398 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
399 // Implemented by a language to provide support for code navigation, event generation, etc.
400 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
401 [ uuid(f386be91-0e80-43af-8eb6-8b829fa06282) ]
402 interface IVsContainedLanguageCodeSupport : IUnknown
405 // Creates a unique event handler name given the class context, name of the object instance, and the name of event.
406 // Name must be unique within all parts of a partial class in the compiler project.
408 HRESULT CreateUniqueEventName([in] LPCWSTR pszClassName,
409 [in] LPCWSTR pszObjectName,
410 [in] LPCWSTR pszNameOfEvent,
411 [out] BSTR* pbstrEventHandlerName);
414 // Creates an event handler given the class context, name of the object instance, name of the event,
415 // and the (unique) name of event handler, if none exist already.
417 // Returns the entire event handler body and a string representation that uniquely identifies the
418 // event member within the given class context. Or alteratively may make the edits and return NULL
419 // for the handler body.
421 // In the case where the event handler already exists, the unique member ID of that class member is
422 // returned with a NULL for both the event body and insertion point.
424 // You may also return NULL for event body and insertion point if your language inserts the event
425 // handler itself. In this case you must return a unique member ID for the event handler you created.
427 // itemidInsertionPoint indicates the file/buffer where the designer would like to put a new method.
428 // If the method doesn't exist the insertion point returned through pSpanInsertionPoint is for the
429 // buffer of the requested itemid.
431 // If pszEventHandlerName is not a valid event handler name E_INVALIDARG should be returned
433 // A FAILED() HRESULT must be returned if pszClassName does not exist in the requested buffer specified
434 // by itemidInsertionPoint.
436 // If you choose to make the edits to the file yourself E_ABORT should be returned in the case the user
437 // cancels checkout or the file is read only.
439 HRESULT EnsureEventHandler([in] LPCWSTR pszClassName,
440 [in] LPCWSTR pszObjectTypeName,
441 [in] LPCWSTR pszNameOfEvent,
442 [in] LPCWSTR pszEventHandlerName,
443 [in] VSITEMID itemidInsertionPoint,
444 [out] BSTR* pbstrUniqueMemberID,
445 [out] BSTR* pbstrEventBody,
446 [out] TextSpan* pSpanInsertionPoint);
450 // Given a class member, this obtains the position (viz., starting character index, starting line,
451 // ending character index, ending line, and itemid of file) in the secondary buffer co-ordinates
452 // or partial class file buffer coordinates that could be cached and later used to navigate to that member.
454 HRESULT GetMemberNavigationPoint([in] LPCWSTR pszClassName,
455 [in] LPCWSTR pszUniqueMemberID,
456 [out] TextSpan* pSpanNavPoint,
457 [out] VSITEMID* pItemID);
460 // Returns a collection of members corresponding to the flags passed in.
461 // For each member, its name and unique member identifier are returned.
462 // GetMembers must work on all parts of partial class in compiler project.
464 HRESULT GetMembers([in] LPCWSTR pszClassName,
465 [in] DWORD dwFlags,
466 [out] int* pcMembers,
467 [out] BSTR** ppbstrDisplayNames,
468 [out] BSTR** ppbstrMemberIDs);
471 // Notification from ContainedLanguageHost that a rename of the specified type was initiated.
472 // bstrOldID and bstrNewID are fully qualified.
473 HRESULT OnRenamed([in] ContainedLanguageRenameType clrt,
474 [in] BSTR bstrOldID,
475 [in] BSTR bstrNewID);
478 // Examines the provided ID to see if it is a valid identifier for the contained language
479 // If you implement DTE::CodeModel::IsValidID this should be implemented similarly
481 HRESULT IsValidID([in] BSTR bstrID, [out] VARIANT_BOOL* pfIsValidID);
484 // Returns the base class name for the provided class
485 // pszClassname - The full name of the class Namespace1.Namespace2.Class1
486 // pbstrBaseClassName - The full name of the baseclass System.Web.UI.Page
488 HRESULT GetBaseClassName([in]LPCWSTR pszClassName, [out]BSTR* pbstrBaseClassName);
491 // Returns the unique member id of an event handler matching
492 // the provided description if exists. If the handler does not exist
493 // SUCCESS is retuned and pbstrUniqueMemberID is NULL.
495 HRESULT GetEventHandlerMemberID([in] LPCWSTR pszClassName,
496 [in] LPCWSTR pszObjectTypeName,
497 [in] LPCWSTR pszNameOfEvent,
498 [in] LPCWSTR pszEventHandlerName,
499 [out] BSTR* pbstrUniqueMemberID);
502 // Returns a collection of existing members that match the
503 // the signature of the provided event description.
505 HRESULT GetCompatibleEventHandlers([in] LPCWSTR pszClassName,
506 [in] LPCWSTR pszObjectTypeName,
507 [in] LPCWSTR pszNameOfEvent,
508 [out] int* pcMembers,
509 [out] BSTR** ppbstrEventHandlerNames,
510 [out] BSTR** ppbstrMemberIDs);
514 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
515 // Implemented by a language to provide support for static event generation.
516 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
517 [ uuid(22ff7776-2c9a-48c4-809f-39e5184cc32d) ]
518 interface IVsContainedLanguageStaticEventBinding : IUnknown
521 // Returns a collection of events that are statically handled.
522 // For each event, its name and the handler name and its unique member identifier are returned.
523 // GetHandledEventsForObject must work on all parts of partial class in compiler project.
525 HRESULT GetStaticEventBindingsForObject([in] LPCWSTR pszClassName,
526 [in] LPCWSTR pszObjectName,
527 [out] int* pcMembers,
528 [out] BSTR** ppbstrEventNames,
529 [out] BSTR** ppbstrDisplayNames,
530 [out] BSTR** ppbstrMemberIDs);
533 // Removes the event binding from the specified member.
535 // Returns E_ABORT if file is read-only or can not be checked out.
537 HRESULT RemoveStaticEventBinding([in] LPCWSTR pszClassName,
538 [in] LPCWSTR pszUniqueMemberID,
539 [in] LPCWSTR pszObjectName,
540 [in] LPCWSTR pszNameOfEvent);
543 // Adds an event binding to the specified member.
545 // Returns E_ABORT if file is read-only or can not be checked out.
547 HRESULT AddStaticEventBinding([in] LPCWSTR pszClassName,
548 [in] LPCWSTR pszUniqueMemberID,
549 [in] LPCWSTR pszObjectName,
550 [in] LPCWSTR pszNameOfEvent);
554 // Creates an event handler given the class context, name of the object instance, name of the event,
555 // and the (unique) name of event handler, if none exist already.
557 // Returns the entire event handler body and a string representation that uniquely identifies the
558 // event member within the given class context. Or alteratively may make the edits and return NULL
559 // for the handler body.
561 // In the case where the event handler already exists, the unique member ID of that class member is
562 // returned with a NULL for both the event body and insertion point.
564 // You may also return NULL for event body and insertion point if your language inserts the event
565 // handler itself. In this case you must return a unique member ID for the event handler you created.
567 // itemidInsertionPoint indicates the file/buffer where the designer would like to put a new method.
568 // If the method doesn't exist the insertion point returned through pSpanInsertionPoint is for the
569 // buffer of the requested itemid.
571 // If pszEventHandlerName is not a valid event handler name E_INVALIDARG should be returned
573 // A FAILED() HRESULT must be returned if pszClassName does not exist in the requested buffer specified
574 // by itemidInsertionPoint.
576 // If you choose to make the edits to the file yourself E_ABORT should be returned if the user
577 // cancels checkout or the file is read only.
579 HRESULT EnsureStaticEventHandler([in] LPCWSTR pszClassName,
580 [in] LPCWSTR pszObjectTypeName,
581 [in] LPCWSTR pszObjectName,
582 [in] LPCWSTR pszNameOfEvent,
583 [in] LPCWSTR pszEventHandlerName,
584 [in] VSITEMID itemidInsertionPoint,
585 [out] BSTR* pbstrUniqueMemberID,
586 [out] BSTR* pbstrEventBody,
587 [out] TextSpan* pSpanInsertionPoint);
591 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
592 // Implemented by project to provide single-file web form support
593 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
594 [ uuid (2139dfc1-b0ad-4c17-a817-74f2ba47c714) ]
595 interface IVsWebFormDesignerSupport : IUnknown
597 // returns the pointer for the language’s code dom provider
598 HRESULT GetCodeDomProvider([out] IUnknown **ppProvider);
600 // adds a reference to the page
601 HRESULT AddReference([in] LPCWSTR pszReference);
605 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
606 // Standard enumerator for code block TextSpan pairs
607 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
608 [ uuid(07a45a82-5354-4dde-ac7d-60f2cdd5573b) ]
609 interface IVsEnumCodeBlocks : IUnknown
611 HRESULT Next ([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] TextSpanAndCookie *rgelt, [out] ULONG *pceltFetched);
612 HRESULT Skip ([in] ULONG celt);
613 HRESULT Reset (void);
614 HRESULT Clone ([out] IVsEnumCodeBlocks **ppenum);
618 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
619 // Implemented by a language to support buffer span mapping
620 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
621 [ uuid(171a72ae-bae6-4b66-9a58-4691f08ed9f2)]
622 interface IVsContainedCode : IUnknown
624 // returns an enumerator of original code block mappings
625 HRESULT EnumOriginalCodeBlocks([out] IVsEnumCodeBlocks **ppEnum);
627 // notifies provider of spans that buffer coordinator has been updated with new spans
628 HRESULT HostSpansUpdated();
632 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
633 // Implemented by language service to provide creation of contained languages
635 // NOTE: This can be QSed globally with a language service ID and this as the interface
636 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
637 [ uuid(9fd1bd52-9d32-4697-b446-36582b865c34) ]
638 interface IVsContainedLanguageFactory : IUnknown
640 // returns an IVsContainedLanguage that a primary language can use to delegate certain responsibilities to a contained language
641 HRESULT GetLanguage([in] IVsHierarchy *pHierarchy,
642 [in] VSITEMID itemid,
643 [in] IVsTextBufferCoordinator *pBufferCoordinator,
644 [out, retval] IVsContainedLanguage **ppLanguage);
647 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
648 // Implemented by project to provide the project name used in the creation of the contained language
649 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
650 [ uuid(f77b0dd6-420b-4e7c-a0b3-c8d5b10a0997) ]
651 interface IVsContainedLanguageProjectNameProvider : IUnknown
653 HRESULT GetProjectName([in] VSITEMID itemid, [out, retval] BSTR *pbstrProjectName);
656 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
657 // Used to create a new span mapping. More fields coming later
658 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
659 typedef struct _tag_NewSpanMapping
661 // tspSpans.span1 is primary buffer span, tspSpans.span2 is secondary buffer span
662 TextSpanPair tspSpans;
663 // Any data supplied by the user. The data is copied during SetSpanMappings
664 // and release when span marker goes away or SetSpanMappings(NULL, 0) is called.
665 VARIANT varUserData;
666 } NewSpanMapping;
668 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
669 // Used to create a new external error
670 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
671 typedef struct _tag_ExternalError
673 long iLine;
674 long iCol;
675 long iErrorID;
676 BOOL fError; // True for error, false for warning.
677 BSTR bstrText;
678 BSTR bstrFileName;
679 } ExternalError;
681 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
682 // VsTextBufferCoordinator coclass
683 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
685 [ uuid(5FCEEA4C-D49F-4acd-B816-130A5DCD4C54) ]
686 interface IVsEnumBufferCoordinatorSpans : IUnknown
688 HRESULT Next([in] ULONG celt, [in, out] NewSpanMapping* rgelt, [out] ULONG* pceltFetched);
689 HRESULT Skip([in] ULONG celt);
690 HRESULT Reset();
691 HRESULT Clone([out] IVsEnumBufferCoordinatorSpans** ppEnum);
694 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
695 // VsTextBufferCoordinator coclass
696 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
698 uuid(3e77fa94-526f-4233-bf81-b2b0329a62b9),
699 helpstring("VsTextBufferCoordinator Class")
701 coclass VsTextBufferCoordinator
703 interface IVsTextBufferCoordinator;
706 enum BufferCoordinatorReplicationDirection
708 BCRD_PRIMARY_TO_SECONDARY = 1,
709 BCRD_SECONDARY_TO_PRIMARY = 2
712 enum _BufferCoordinatorMappingMode
714 // default, primary span = secondary span
715 BCMM_NORMAL = 0,
716 // Primary span is 2 characters wider, but only inner part gets replicated.
717 // Used to prevent deletion of text markers when one of the spans collapses
718 // into 0 characters (say, user deletes everything in the span range).
719 // For instance, when user deletes everything in a script block. In extended
720 // mode primary span includes > from opening <script> and < from closing </script>.
721 // However, only inner (+1, -1 character) part gets replicated between buffers.
722 // Normally the mode should only be changed when there are no mappings.
723 // If you change mapping mode when coordinator already has span mappings,
724 // the result is unpredictable.
725 // Note : BCMM_EXTENDED is ( BCMM_EXTENDEDLEFT | BCMM_EXTENDEDRIGHT )
726 BCMM_EXTENDEDLEFT = 0x2,
727 BCMM_EXTENDEDRIGHT = 0x1,
728 BCMM_EXTENDED = 0x3,
729 // 'Entire buffer' mode means that the buffer is a single span, so no markers
730 // are required. This is a special mode since if one creates a marker to track
731 // the entire buffer, the marker will be deleted when user deletes the entire
732 // buffer content and all subsecuent events will be lost. There is no way to
733 // create a marker that is wider than the buffer.
734 // This mode superseeds any other bit flags set.
735 BCMM_ENTIREBUFFER = 0x4
737 typedef DWORD BufferCoordinatorMappingMode;
739 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
740 // Provides text buffer mapping services
742 // NOTE: The buffer coordinator will only fire events to secondary buffer that fall entirely within mapped spans
743 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
744 [uuid(84465401-2886-4ce0-af50-c0560226ed40)]
745 interface IVsTextBufferCoordinator : IUnknown
747 HRESULT SetBuffers([in] IVsTextLines *pPrimaryBuffer, [in] IVsTextLines *pSecondaryBuffer);
748 HRESULT SetSpanMappings([in] long cSpans, [in, size_is(cSpans)] NewSpanMapping *rgSpans);
749 HRESULT MapPrimaryToSecondarySpan([in] TextSpan tsPrimary, [out] TextSpan *ptsSecondary);
750 HRESULT MapSecondaryToPrimarySpan([in] TextSpan tsSecondary, [out] TextSpan *ptsPrimary);
751 HRESULT GetPrimaryBuffer([out] IVsTextLines **ppBuffer);
752 HRESULT GetSecondaryBuffer([out] IVsTextLines **ppBuffer);
753 HRESULT EnableReplication([in] DWORD bcrd, [in] BOOL fEnable);
754 HRESULT GetMappingOfPrimaryPosition([in] long lPosition, [out] TextSpan *ptsPrimary, [out] TextSpan *ptsSecondary);
755 // Both modes must be the same except when one of them is BCMM_ENTIREBUFFER.
756 HRESULT SetBufferMappingModes([in] DWORD bcmmPrimary, [in] DWORD bcmmSecondary);
757 // Enumerates existing spans. Note that state is copied, so if you change the buffer
758 // during enumeration, the change will not be reflected and enum becomes out of date.
759 HRESULT EnumSpans(IVsEnumBufferCoordinatorSpans** ppEnum);
762 [uuid(98CEEDBD-07A4-4376-ADE8-5A46B7F5F384)]
763 interface IVsSetSpanMappingEvents : IUnknown
765 HRESULT OnBeginSetSpanMappings([in] long cSpans, [in, size_is(cSpans)] NewSpanMapping *rgSpans);
766 HRESULT OnEndSetSpanMappings();
767 HRESULT OnMarkerInvalidated([in]IVsTextLines *pBuffer, [in]IVsTextMarker *pMarker);
770 /////////////////////////////////////////////////////////////////////////////////
771 // IVsCompletionSetEx interface
772 /////////////////////////////////////////////////////////////////////////////////
774 uuid(uuid_IVsExternalCompletionSet)
776 interface IVsExternalCompletionSet : IUnknown
778 HRESULT SetIntellisenseHost ([in] IVsIntellisenseHost *pHost);
779 HRESULT UpdateCompSet();
782 uuid(uuid_IVsExpansionIntellisenseHost)
784 interface IVsExpansionIntellisenseHost : IUnknown
786 HRESULT GetTextLen([out] long *iLen);
787 HRESULT GetText([out] BSTR *bstrText);
788 HRESULT GetSelection([out] long *iStart, [out] long *iEnd);
789 HRESULT SetSelection([in] long iStart, [in] long iEnd);
790 // if fReplaceAll is true, this will replace all text in the buffer (including prefix text).
791 // otherwise, it will replace anything within the selection or insert at the selection location if there is a zero-len selection.
792 HRESULT SetText([in] BSTR bstrText, [in] BOOL fReplaceAll);
793 HRESULT GetCurrentLevel([out] long *pLevel);
797 uuid(uuid_IVsReportExternalErrors)
799 interface IVsReportExternalErrors : IUnknown
801 HRESULT ClearAllErrors();
802 HRESULT AddNewErrors([in]IVsEnumExternalErrors *pErrors);
803 HRESULT GetErrors([out] IVsEnumExternalErrors **pErrors);
807 uuid(uuid_IVsEnumExternalErrors)
809 interface IVsEnumExternalErrors : IUnknown
811 HRESULT Next([in] ULONG celt, [in, out] ExternalError *rgelt, [out] ULONG* pceltFetched);
812 HRESULT Skip([in] ULONG celts);
813 HRESULT Reset();
814 HRESULT Clone([out] IVsEnumExternalErrors **ppErrors);
818 #ifndef INTEROPLIB
820 }; //library
822 #endif