[svn] r6698: vs-plugin/trunk/Nemerle.VsIntegration:
LanguageService/NemerleColorableItem.cs LanguageServic...
IT
svnadmin at nemerle.org
Sun Sep 24 06:04:41 CEST 2006
Log:
C# integration project refactoring.
Author: IT
Date: Sun Sep 24 06:04:38 2006
New Revision: 6698
Modified:
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleColorableItem.cs
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs
vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj
Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleColorableItem.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleColorableItem.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleColorableItem.cs Sun Sep 24 06:04:38 2006
@@ -1,74 +1,64 @@
-/***************************************************************************
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-This code is licensed under the Visual Studio SDK license terms.
-THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-
-***************************************************************************/
-
using System;
+using Microsoft.VisualStudio;
using Microsoft.VisualStudio.TextManager.Interop;
-namespace Microsoft.Samples.VisualStudio.LanguageService
+namespace Nemerle.VisualStudio.LanguageService
{
public class NemerleColorableItem : IVsColorableItem
{
+ #region ctor
- private string displayName;
- private COLORINDEX background;
- private COLORINDEX foreground;
-
- public NemerleColorableItem(string displayName, COLORINDEX foreground,
- COLORINDEX background)
+ public NemerleColorableItem(string displayName, COLORINDEX foreground, COLORINDEX background)
{
- this.displayName = displayName;
- this.background = background;
- this.foreground = foreground;
+ _displayName = displayName;
+ _background = background;
+ _foreground = foreground;
}
+ #endregion
+
+ #region Fields
+
+ private string _displayName;
+ private COLORINDEX _background;
+ private COLORINDEX _foreground;
+
+ #endregion
+
#region IVsColorableItem Members
- public int GetDefaultColors(
- COLORINDEX[] piForeground,
- COLORINDEX[] piBackground)
- {
- if (null == piForeground)
+ public int GetDefaultColors(COLORINDEX[] piForeground, COLORINDEX[] piBackground)
{
+ if (piForeground == null)
throw new ArgumentNullException("piForeground");
- }
- if (0 == piForeground.Length)
- {
+
+ if (piForeground.Length == 0)
throw new ArgumentOutOfRangeException("piForeground");
- }
- piForeground[0] = foreground;
- if (null == piBackground)
- {
+ piForeground[0] = _foreground;
+
+ if (piBackground == null)
throw new ArgumentNullException("piBackground");
- }
- if (0 == piBackground.Length)
- {
+
+ if (piBackground.Length == 0)
throw new ArgumentOutOfRangeException("piBackground");
- }
- piBackground[0] = background;
- return Microsoft.VisualStudio.VSConstants.S_OK;
+ piBackground[0] = _background;
+
+ return VSConstants.S_OK;
}
public int GetDefaultFontFlags(out uint pdwFontFlags)
{
pdwFontFlags = 0;
- return Microsoft.VisualStudio.VSConstants.S_OK;
+ return VSConstants.S_OK;
}
public int GetDisplayName(out string pbstrName)
{
- pbstrName = displayName;
- return Microsoft.VisualStudio.VSConstants.S_OK;
+ pbstrName = _displayName;
+ return VSConstants.S_OK;
}
#endregion
Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs Sun Sep 24 06:04:38 2006
@@ -15,10 +15,10 @@
public class NemerleSource : Source
{
- ScopeCreatorCallback scopeCreator;
-
- public NemerleSource(NemerleLanguageService service, IVsTextLines textLines,
- Colorizer colorizer) : base(service, textLines, colorizer) {}
+ public NemerleSource(NemerleLanguageService service, IVsTextLines textLines, Colorizer colorizer)
+ : base(service, textLines, colorizer)
+ {
+ }
public override CommentInfo GetCommentFormat()
{
@@ -32,10 +32,13 @@
return commentInfo;
}
+ // _scopeCreator is never created or assigned. Probably it should be removed.
+ //
+ private ScopeCreatorCallback _scopeCreator;
public ScopeCreatorCallback ScopeCreator
{
- get { return scopeCreator; }
- set { scopeCreator = value; }
+ get { return _scopeCreator; }
+ set { _scopeCreator = value; }
}
public override void Completion(IVsTextView textView, TokenInfo info, ParseReason reason)
@@ -54,33 +57,21 @@
for (int i = 0; i < lineChange.Length; i++)
{
- TextLineChange changes = ConvertToLocation(lineChange[i]);
+ TextLineChange changes = lineChange[i];
projectInfo.AddRelocation(
fileName,
- changes.iNewEndIndex,
- changes.iNewEndLine,
- changes.iOldEndIndex,
- changes.iOldEndLine,
- changes.iStartIndex,
- changes.iStartLine);
+ changes.iNewEndIndex + 1,
+ changes.iNewEndLine + 1,
+ changes.iOldEndIndex + 1,
+ changes.iOldEndLine + 1,
+ changes.iStartIndex + 1,
+ changes.iStartLine + 1);
}
base.OnChangeLineText(lineChange, last);
}
- private static TextLineChange ConvertToLocation(TextLineChange changes)
- {
- changes.iNewEndIndex++;
- changes.iNewEndLine++;
- changes.iOldEndIndex++;
- changes.iOldEndLine++;
- changes.iStartIndex++;
- changes.iStartLine++;
-
- return changes;
- }
-
internal class ErrorNode
{
public string Uri;
Modified: vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj Sun Sep 24 06:04:38 2006
@@ -73,7 +73,6 @@
<Compile Include="HierarchyListener.cs" />
<Compile Include="Library.cs" />
<Compile Include="LibraryNode.cs" />
- <Compile Include="NemerleColorableItem.cs" />
<Compile Include="NemerleConstants.cs" />
<Compile Include="LanguageService\NemerleDeclarations.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -130,6 +129,7 @@
</Compile>
<Compile Include="LanguageService\NemerleAuthoringScope.cs" />
<Compile Include="LanguageService\NemerleAuthoringSink.cs" />
+ <Compile Include="LanguageService\NemerleColorableItem.cs" />
<Compile Include="LanguageService\NemerleLanguageService.cs" />
<Compile Include="LanguageService\NemerleScanner.cs" />
<Compile Include="LanguageService\NemerleSource.cs" />
More information about the svn
mailing list