Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup vs ext 2 #358

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Microsoft.VisualStudio.FSharp.LanguageService.Resources;

namespace Microsoft.VisualStudio.FSharp.LanguageService {
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager"]/*' />
/// <summary>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have sent a question to our MSDN doc team about whether this will break, internal doc generation tooling. My suspicion is that these comments are necessary. But I honestly don't know.

*** Update ****
Got the word back from the msdn doc guys, they don't recognize any of the files, so they believe it's safe to make these changes.


In some ways that's the problem with all of this clean up, it is certainly needed but there are more teams that depend on, and can make changes to this codebase than just us. That's not to say it isn't worth finding out, however, inadvertently breaking or even worse silently braking a bunch of teams who don't expect there to be any changes is always unfortunate.

I realize this seems silly, but I worry about these cleanup type PR's much more than the bug fix ones. It is true I may have been at Microsoft too long ... because often the principle of least change is the one that guides our work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i splitted changes in multiple commits 😄 , feel free to use what you think is ok.
I understand the uex include is good for reference doc/examples etc, so np if used, but i dont see this repo on msdn

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The F# language service definitely isn't documented on MSDN, but it doesn't hurt to double check with the doc people.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, as i said, easy to remove this commit from pr.
With pr is easier to revert than ask and wait for permission

Btw maybe if these file are needed, the files exists in an internal repo of doc team? Doc is a good candidate for open source contribution.
just curious of msdn page source like List.append with example etc 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KevinRansom nice, thx

/// CodeWindowManager provides a default implementation of the VSIP interface IVsCodeWindowManager
/// and manages the LanguageService, Source, ViewFilter, and DocumentProperties objects associated
Expand Down Expand Up @@ -42,7 +41,6 @@ public class CodeWindowManager : IVsCodeWindowManager {
DocumentProperties properties;
#endif

/// <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
Expand All @@ -58,14 +56,12 @@ public class CodeWindowManager : IVsCodeWindowManager {
#endif
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.Finalize"]/*' />
~CodeWindowManager() {
#if LANGTRACE
Trace.WriteLine("~CodeWindowManager");
#endif
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.Close"]/*' />
/// <summary>Closes all view filters, and the document properties window</summary>
internal void Close() {
#if LANGTRACE
Expand Down Expand Up @@ -93,17 +89,14 @@ public class CodeWindowManager : IVsCodeWindowManager {
}
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.LanguageService;"]/*' />
/// <summary>Returns the LanguageService object that created this code window manager</summary>
internal LanguageService LanguageService {
get { return this.service; }
}
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.Source;"]/*' />
/// <summary>returns the Source object associated with the IVsTextLines buffer for this code window</summary>
internal ISource Source {
get { return this.source; }
}
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.GetFilter;"]/*' />
/// <summary>
/// Returns the ViewFilter for the given view or null if no matching filter is found.
/// </summary>
Expand All @@ -118,7 +111,6 @@ public class CodeWindowManager : IVsCodeWindowManager {
}

#if DOCUMENT_PROPERTIES
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.Properties;"]/*' />
/// <summary>Returns the DocumentProperties, if any. You can update this property if you want to
/// change the document properties on the fly.</summary>
internal DocumentProperties Properties {
Expand All @@ -132,19 +124,15 @@ public class CodeWindowManager : IVsCodeWindowManager {
}
}
#endif
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.DropDownHelper"]/*' />
/// <summary>Return the optional TypeAndMemberDropdownBars object for the drop down combos</summary>
internal TypeAndMemberDropdownBars DropDownHelper {
get { return this.dropDownHelper; }
}
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.CodeWindow"]/*' />
/// <summary>Return the IVsCodeWindow associated with this code window manager.</summary>
internal IVsCodeWindow CodeWindow {
get { return this.codeWindow; }
}

#region IVsCodeWindowManager methods
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.AddAdornments"]/*' />
/// <summary>Install the optional TypeAndMemberDropdownBars, and primary and secondary view filters</summary>
public virtual int AddAdornments() {
#if LANGTRACE
Expand Down Expand Up @@ -182,7 +170,6 @@ public class CodeWindowManager : IVsCodeWindowManager {
return NativeMethods.S_OK;
}

/// <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() {
Expand Down Expand Up @@ -212,7 +199,6 @@ public class CodeWindowManager : IVsCodeWindowManager {
return NativeMethods.S_OK;
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.OnNewView"]/*' />
/// <summary>Install a new view filter for the given view. This method calls your
/// CreateViewFilter method.</summary>
public virtual int OnNewView(IVsTextView newView) {
Expand All @@ -224,11 +210,9 @@ public class CodeWindowManager : IVsCodeWindowManager {
return NativeMethods.S_OK;
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.OnKillFocus"]/*' />
public virtual void OnKillFocus(IVsTextView textView) {
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="CodeWindowManager.OnSetFocus"]/*' />
/// <summary>Refresh the document properties</summary>
public virtual void OnSetFocus(IVsTextView textView) {
#if DOCUMENT_PROPERTIES
Expand All @@ -237,13 +221,11 @@ public class CodeWindowManager : IVsCodeWindowManager {
}
#endif
}
#endregion

}



/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars"]/*' />
/// <summary>
/// Represents the two drop down bars on the top of a text editor window that allow
/// types and type members to be selected by name.
Expand Down Expand Up @@ -274,14 +256,12 @@ internal abstract class TypeAndMemberDropdownBars : IVsDropdownBarClient {
const int DropClasses = 0;
const int DropMethods = 1;

/// <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();
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.Done"]/*' />
public void Done() { //TODO: use IDisposable pattern
if (this.imageList != null) {
imageList.Dispose();
Expand All @@ -301,7 +281,6 @@ internal abstract class TypeAndMemberDropdownBars : IVsDropdownBarClient {



/// <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.
Expand All @@ -320,7 +299,6 @@ internal abstract class TypeAndMemberDropdownBars : IVsDropdownBarClient {


// IVsDropdownBarClient methods
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.GetComboAttributes"]/*' />
public virtual int GetComboAttributes(int combo, out uint entries, out uint entryType, out IntPtr iList) {
entries = 0;
entryType = 0;
Expand All @@ -341,7 +319,6 @@ private enum DropDownItemType {
HasImage = 4
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.GetComboTipText"]/*' />
public virtual int GetComboTipText(int combo, out string text) {
if (combo == TypeAndMemberDropdownBars.DropClasses)
text = SR.GetString(SR.ComboTypesTip);
Expand All @@ -350,7 +327,6 @@ private enum DropDownItemType {
return NativeMethods.S_OK;
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.GetEntryAttributes"]/*' />
public virtual int GetEntryAttributes(int combo, int entry, out uint fontAttrs) {
fontAttrs = (uint)DROPDOWNFONTATTR.FONTATTR_PLAIN;
DropDownMember member = GetMember(combo, entry);
Expand All @@ -360,7 +336,6 @@ private enum DropDownItemType {
return NativeMethods.S_OK;
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.GetEntryImage"]/*' />
public virtual int GetEntryImage(int combo, int entry, out int imgIndex) {
// this happens during drawing and has to be fast
imgIndex = -1;
Expand All @@ -371,7 +346,6 @@ private enum DropDownItemType {
return NativeMethods.S_OK;
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.GetEntryText"]/*' />
public virtual int GetEntryText(int combo, int entry, out string text) {
text = null;
DropDownMember member = GetMember(combo, entry);
Expand All @@ -381,12 +355,10 @@ private enum DropDownItemType {
return NativeMethods.S_OK;
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.OnComboGetFocus"]/*' />
public virtual int OnComboGetFocus(int combo) {
return NativeMethods.S_OK;
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.GetMember"]/*' />
public DropDownMember GetMember(int combo, int entry) {
if (combo == TypeAndMemberDropdownBars.DropClasses) {
if (this.dropDownTypes != null && entry >= 0 && entry < this.dropDownTypes.Count)
Expand All @@ -398,7 +370,6 @@ private enum DropDownItemType {
return null;
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.OnItemChosen"]/*' />
public virtual int OnItemChosen(int combo, int entry) {
DropDownMember member = GetMember(combo, entry);
if (!Object.ReferenceEquals(member,null)) {
Expand All @@ -417,11 +388,9 @@ private enum DropDownItemType {
return NativeMethods.S_OK;
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.SetFocus"]/*' />
[DllImport("user32.dll")]
static extern void SetFocus(IntPtr hwnd);

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="TypeAndMemberDropdownBars.OnItemSelected"]/*' />
public int OnItemSelected(int combo, int index) {
//nop
return NativeMethods.S_OK;
Expand All @@ -433,15 +402,13 @@ private enum DropDownItemType {
}
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DropDownMember"]/*' />
internal class DropDownMember : IComparable {

private string label;
private TextSpan span;
private int glyph;
private DROPDOWNFONTATTR fontAttr;

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DropDownMember.Label;"]/*' />
public string Label {
get {
return this.label;
Expand All @@ -451,7 +418,6 @@ internal class DropDownMember : IComparable {
}
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DropDownMember.Span;"]/*' />
public TextSpan Span {
get {
return this.span;
Expand All @@ -460,7 +426,6 @@ internal class DropDownMember : IComparable {
this.span = value;
}
}
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DropDownMember.Glyph;"]/*' />
public int Glyph {
get {
return this.glyph;
Expand All @@ -469,7 +434,6 @@ internal class DropDownMember : IComparable {
this.glyph = value;
}
}
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DropDownMember.FontAttr;"]/*' />
public DROPDOWNFONTATTR FontAttr {
get {
return this.fontAttr;
Expand All @@ -479,7 +443,6 @@ internal class DropDownMember : IComparable {
}
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DropDownMember.DropDownMember"]/*' />
public DropDownMember(string label, TextSpan span, int glyph, DROPDOWNFONTATTR fontAttribute) {
if (label == null) {
throw new ArgumentNullException("label");
Expand All @@ -490,14 +453,12 @@ internal class DropDownMember : IComparable {
this.FontAttr = fontAttribute;
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DropDownMember.CompareTo"]/*' />
public int CompareTo(object obj) {
// if this overload is used then it assumes a case-sensitive current culture comparison
// which allows for case-senstive languages to work
return CompareTo(obj, StringComparison.CurrentCulture);
}

/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DropDownMember.CompareTo"]/*' />
public int CompareTo(object obj, StringComparison stringComparison)
{
if (obj is DropDownMember)
Expand All @@ -508,15 +469,13 @@ public int CompareTo(object obj, StringComparison stringComparison)
}

// Omitting Equals violates FxCop rule: IComparableImplementationsOverrideEquals.
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DropDownMember.Equals"]/*' />
public override bool Equals(Object obj) {
if (!(obj is DropDownMember))
return false;
return (this.CompareTo(obj, StringComparison.CurrentCulture) == 0);
}

// Omitting getHashCode violates FxCop rule: EqualsOverridesRequireGetHashCodeOverride.
/// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DropDownMember.GetHashCode"]/*' />
public override int GetHashCode() {
return this.Label.GetHashCode();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public virtual void Resume()
}

#if COLORABLE_ITEM
/// <include file='doc\Colorizer.uex' path='docs/doc[@for="ColorableItem"]/*' />
[CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(true)]
public class ColorableItem : IVsColorableItem, IVsHiColorItem, IVsMergeableUIItem {
Expand All @@ -55,7 +54,6 @@ public class ColorableItem : IVsColorableItem, IVsHiColorItem, IVsMergeableUIIte
Color hiForeColor, hiBackColor;
FONTFLAGS fontFlags;

/// <include file='doc\Colorizer.uex' path='docs/doc[@for="ColorableItem.ColorableItem"]/*' />
internal ColorableItem(string name, string displayName, COLORINDEX foreColor, COLORINDEX backColor, Color hiForeColor, Color hiBackColor, FONTFLAGS fontFlags) {
this.name = name;
this.displayName = displayName;
Expand All @@ -66,27 +64,20 @@ public class ColorableItem : IVsColorableItem, IVsHiColorItem, IVsMergeableUIIte
this.hiBackColor = hiBackColor;
}

#region IVsColorableItem methods
/// <include file='doc\Colorizer.uex' path='docs/doc[@for="ColorableItem.GetDefaultColors"]/*' />
public virtual int GetDefaultColors(COLORINDEX[] foreColor, COLORINDEX[] backColor) {
if (foreColor != null) foreColor[0] = this.foreColor;
if (backColor != null) backColor[0] = this.backColor;
return NativeMethods.S_OK;
}
/// <include file='doc\Colorizer.uex' path='docs/doc[@for="ColorableItem.GetDefaultFontFlags"]/*' />
public virtual int GetDefaultFontFlags(out uint fontFlags) {
fontFlags = (uint)this.fontFlags;
return NativeMethods.S_OK;
}
/// <include file='doc\Colorizer.uex' path='docs/doc[@for="ColorableItem.GetDisplayName"]/*' />
public virtual int GetDisplayName(out string name) {
name = this.displayName;
return NativeMethods.S_OK;
}
#endregion

#region IVsHiColorItem methods
/// <include file='doc\Colorizer.uex' path='docs/doc[@for="Colorizer.GetColorData"]/*' />
public virtual int GetColorData(int cdElement, out uint crColor)
{
crColor = 0;
Expand Down Expand Up @@ -126,32 +117,25 @@ private uint ColorToRgb(Color color)

return (uint)(red | (green << 8) | (blue << 16));
}
#endregion


#region IVsMergeableUIItem Members

/// <include file='doc\Colorizer.uex' path='docs/doc[@for="ColorableItem.GetCanonicalName"]/*' />
public virtual int GetCanonicalName(out string name) {
name = this.name;
return NativeMethods.S_OK;
}

/// <include file='doc\Colorizer.uex' path='docs/doc[@for="ColorableItem.GetDescription"]/*' />
public virtual int GetDescription(out string desc) {
// The reason this is not implemented is because the core text editor
// doesn't use it.
desc = null;
return NativeMethods.E_NOTIMPL;
}

/// <include file='doc\Colorizer.uex' path='docs/doc[@for="ColorableItem.GetMergingPriority"]/*' />
public virtual int GetMergingPriority(out int priority) {
priority = -1;
return NativeMethods.E_NOTIMPL;
}

#endregion
}
#endif

Expand Down
Loading