This topic has not yet been rated - Rate this topic

LanguagePreferences Class

Provides support for language service-specific preferences.

This API is not CLS-compliant. The CLS-compliant alternative is [None].
Object
  Microsoft.VisualStudio.Package.LanguagePreferences

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
[CLSCompliantAttribute(false)]
[GuidAttribute("934a92fd-b63a-49c7-9284-11aec8c1e03f")]
[ComVisibleAttribute(true)]
public class LanguagePreferences : IVsTextManagerEvents2, 
	IDisposable

The LanguagePreferences type exposes the following members.

  NameDescription
Public methodLanguagePreferences()Initializes a new instance of the LanguagePreferences class (default initialization only).
Public methodLanguagePreferences(IServiceProvider, Guid, String)Initializes a new instance of the LanguagePreferences class (this is the preferred method).
Top
  NameDescription
Public propertyAutoListMembersGets or sets whether members are automatically listed as part of IntelliSense support.
Public propertyAutoOutliningGets or sets whether or not auto-outlining is supported outlining (this requires parser support for hidden regions).
Public propertyCodeSenseDelayGets or sets the number of milliseconds the user must hold the cursor over an identifier before initiating any IntelliSense operation.
Public propertyCutCopyBlankLinesGets or sets whether to include spaces on blank lines when cutting and copying.
Public propertyEnableAsyncCompletionGets or sets if background parsing is supported.
Public propertyEnableCodeSenseGets or sets whether or not IntelliSense is supported.
Public propertyEnableCommentingGets or sets whether or not blocks of code can be commented and uncommented.
Public propertyEnableFormatSelectionGets or sets whether or not code can be formatted.
Public propertyEnableLeftClickForURLsGets or sets whether or not URLs in the code can be navigated to by a simple click.
Public propertyEnableMatchBracesGets or sets whether or not matching braces are supported.
Public propertyEnableMatchBracesAtCaretGets or sets whether or not matching braces can be shown while typing a matching brace.
Public propertyEnableQuickInfoGets or sets whether or not the IntelliSense Quick Info operation is supported.
Public propertyEnableShowMatchingBraceGets or sets whether or not the text included in the span of the matching pair is shown in the status bar.
Public propertyHideAdvancedMembersGets or sets whether or not advanced members are hidden in the IntelliSense members list.
Public propertyHighlightMatchingBraceFlagsGets or sets the flags for highlighting matching braces.
Public propertyIndentSizeGets or sets the number of spaces to indent when formatting source.
Public propertyIndentStyleGets or sets the style used for formatting sections of text.
Public propertyInsertTabsGets or sets whether or not to insert tabs instead of spaces when formatting sections of text.
Protected propertyLanguageNameGets or sets the name the language service is registered under.
Public propertyLineNumbersGets or sets whether or not line numbers are to be shown.
Public propertyMaxErrorMessagesGets or sets the maximum number of error messages that can be shown at any one time.
Public propertyMaxRegionTimeGets or sets the maximum region time.
Public propertyParameterInformationGets or sets whether or not the IntelliSense method tip operation is supported.
Public propertyShowNavigationBarGets or sets whether or not drop-down bars are to be shown.
Protected propertySiteGets or sets the service provider.
Public propertyTabSizeGets or sets the number of spaces a single tab covers.
Public propertyVirtualSpaceGets or sets whether or not the editor should assume spaces at the end of all lines.
Public propertyWordWrapGets or sets whether or not word wrapping is enabled.
Public propertyWordWrapGlyphsGets or sets whether or not a glyph should be shown for a line that is word-wrapped.
Top
  NameDescription
Public methodApplyApplies all changes made to the preferences.
Public methodDisposeCleans up any allocated resources before the object is destroyed.
Public methodEqualsDetermines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetBooleanValueObtains a boolean value from the specified registry entry.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetIntegerValueGets an integer value from the specified registry entry.
Public methodGetLanguagePreferencesGets the modifiable user language settings from Visual Studio.
Public methodGetSiteGets the service provider.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitInitializes LanguagePreferences.
Public methodInitMachinePreferencesGets language service-specific settings from the registry.
Public methodInitUserPreferencesGets user-modifiable settings.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodOnRegisterMarkerTypeCalled when a new marker type is registered with Visual Studio.
Public methodOnRegisterViewCalled when a view is registered.
Public methodOnReplaceAllInFilesBeginCalled when the Replace All in Files operation has begun.
Public methodOnReplaceAllInFilesEndCalled when the Replace All In Files operation has ended.
Public methodOnUnregisterViewCalled when a view is closed.
Public methodOnUserPreferencesChanged2Called when a user preference has been changed.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The base class manages preferences specific to your language service as well as general preferences the user can affect from the Tools -> Options -> Text Editor category.

The following registry entries are specific to language services and are already reflected in properties in the base class. These registry entries are stored in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<X.Y>\Languages\Language Services\<Language Name>.

<X.Y> is the version of Visual Studio (for example, 8.0 or 8.0Exp).

<Language Name> is the name of your language.

Registry entry

Type

Value

Description

CodeSense

DWORD

<0 or 1>

1 indicates support for IntelliSense.

MatchBraces

DWORD

<0 or 1>

1 indicates support for matching braces.

QuickInfo

DWORD

<0 or 1>

1 indicates support for the Quick Info IntelliSense operation.

ShowMatchingBraces

DWORD

<0 or 1>

1 indicates that the text included in the span for a matching pair of language elements is shown in the status bar.

MatchBracesAtCaret

DWORD

<0 or 1>

1 indicates that matching braces can be shown while typing a matching brace.

MaxErrorMessages

DWORD

<number>

The maximum number of error messages that can be put into the Error List Options window from the parser.

CodeSenseDelay

DWORD

<number>

The amount of time in milliseconds the user must hold the cursor over an identifier before triggering an IntelliSense operation.

EnableAsyncCompletion

DWORD

<0 or 1>

1 indicates support for asynchronous or background parsing.

EnableCommenting

DWORD

<0 or 1>

1 indicates support for commenting and uncommenting code in a single operation.

EnableFormatSelection

DWORD

<0 or 1>

1 indicates support for formatting the source text.

AutoOutlining

DWORD

<0 or 1>

1 indicates support for automatic outlining (this requires parser support for hidden regions).

MaxRegions

DWORD

<number>

The maximum number of hidden regions that can be handled in a single file.

Notes to Implementers

If you have any language-specific properties in addition to those already supported by the base class, you have to derive a class from LanguagePreferences and return an instance of your class from the GetLanguagePreferences method. Be sure to call the Initialize method before returning your language preferences instance. In addition, you must override InitUserPreferences, OnUserPreferencesChanged2, and Apply methods to support accessing your specified properties.

It is assumed that a single instance of the LanguagePreferences object is maintained for your language service. In this way, any changes the user makes to the properties are dynamically updated in your preferences and from there, throughout the language service.

Notes to Callers

An instance of this class is returned from the LanguageService method GetLanguagePreferences. A number of properties are referenced throughout the managed package framework version of the language service classes.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.