Skip to content

Commit

Permalink
Fix F# signature warnings (#2896)
Browse files Browse the repository at this point in the history
The F# compiler recently added warnings when the parameter names in
signature and implementation files were different. This triggered for a
number of signatures in VsVim (not as consistent as I thought). Cleaned
all those up and got rid of the warnings.
  • Loading branch information
jaredpar committed Jun 2, 2021
1 parent 34b52d4 commit f47ea16
Show file tree
Hide file tree
Showing 22 changed files with 326 additions and 110 deletions.
9 changes: 6 additions & 3 deletions Src/VimCore/CaretChangeTracker.fs
Expand Up @@ -6,11 +6,14 @@ open System.ComponentModel.Composition
/// Ensure view properties after external caret events
type internal CaretChangeTracker
(
_vimBuffer: IVimBuffer,
_commonOperations: ICommonOperations,
_mouseDevice: IMouseDevice
vimBuffer: IVimBuffer,
commonOperations: ICommonOperations,
mouseDevice: IMouseDevice
) as this =

let _vimBuffer = vimBuffer
let _commonOperations = commonOperations
let _mouseDevice = mouseDevice
let _globalSettings = _vimBuffer.GlobalSettings
let _textView = _vimBuffer.TextView
let _vimHost = _vimBuffer.Vim.VimHost
Expand Down
8 changes: 4 additions & 4 deletions Src/VimCore/FSharpUtil.fs
Expand Up @@ -660,16 +660,16 @@ module CharUtil =
/// The .Net mapping for the keys defined in :help key-notation
module internal CharCodes =

/// <Nul>
/// Nul key
let Zero = char 0

/// <CR> / <Return> / <Enter>
/// CR / Return / Enter key
let Enter = CharUtil.OfAsciiValue 13uy

/// <ESC>
/// ESC key
let Escape = CharUtil.OfAsciiValue 27uy

/// <BS>
/// BS key
let Backspace = '\b'

module internal StringBuilderExtensions =
Expand Down
4 changes: 2 additions & 2 deletions Src/VimCore/HistoryUtil.fs
Expand Up @@ -284,7 +284,7 @@ and internal HistoryUtil () =

static member KeyInputMap = _keyInputMap

static member CreateHistorySession<'TData, 'TResult> historyClient clientData command localAbbreviationMap motionUtil =
let historySession = HistorySession<'TData, 'TResult>(historyClient, clientData, command, localAbbreviationMap, motionUtil)
static member CreateHistorySession<'TData, 'TResult> historyClient initialClientData command localAbbreviationMap motionUtil =
let historySession = HistorySession<'TData, 'TResult>(historyClient, initialClientData, command, localAbbreviationMap, motionUtil)
historySession :> IHistorySession<'TData, 'TResult>

2 changes: 1 addition & 1 deletion Src/VimCore/HistoryUtil.fsi
Expand Up @@ -6,7 +6,7 @@ namespace Vim
type internal HistoryUtil =

/// Begin a history related operation
static member CreateHistorySession<'TData, 'TResult> : IHistoryClient<'TData, 'TResult> -> initialData: 'TData -> editableCommand: EditableCommand -> localAbbreviationMap: IVimLocalAbbreviationMap -> motionUtil: IMotionUtil -> IHistorySession<'TData, 'TResult>
static member CreateHistorySession<'TData, 'TResult> : IHistoryClient<'TData, 'TResult> -> initialClientData: 'TData -> command: EditableCommand -> localAbbreviationMap: IVimLocalAbbreviationMap -> motionUtil: IMotionUtil -> IHistorySession<'TData, 'TResult>

/// The set of KeyInput values which history considers to be a valid command
static member CommandNames: KeyInput list
17 changes: 7 additions & 10 deletions Src/VimCore/IncrementalSearch.fs
Expand Up @@ -289,20 +289,17 @@ type internal IncrementalSearchSession

type internal IncrementalSearch
(
_vimBufferData: IVimBufferData,
_operations: ICommonOperations,
_motionUtil: IMotionUtil
vimBufferData: IVimBufferData,
commonOperations: ICommonOperations,
motionUtil: IMotionUtil
) =

// TODO: most of these aren't needed anymore.
let _vimData = _vimBufferData.Vim.VimData
let _statusUtil = _vimBufferData.StatusUtil
let _vimBufferData = vimBufferData
let _operations = commonOperations
let _motionUtil = motionUtil
let _vimTextBuffer = _vimBufferData.VimTextBuffer
let _wordNavigator = _vimTextBuffer.WordNavigator
let _localSettings = _vimTextBuffer.LocalSettings
let _globalSettings = _localSettings.GlobalSettings
let _textView = _operations.TextView
let _searchService = _vimBufferData.Vim.SearchService
let _globalSettings = _vimTextBuffer.GlobalSettings

let mutable _session: IncrementalSearchSession option = None
let _sessionCreated = StandardEvent<IncrementalSearchSessionEventArgs>()
Expand Down
14 changes: 8 additions & 6 deletions Src/VimCore/Interpreter_Parser.fs
Expand Up @@ -108,10 +108,12 @@ and LineCommandBuilder

and [<Sealed>] internal Parser
(
_globalSettings: IVimGlobalSettings,
_vimData: IVimData
globalSettings: IVimGlobalSettings,
vimData: IVimData
) as this =

let _globalSettings = globalSettings
let _vimData = vimData
let _parseResultBuilder = ParseResultBuilder(this)
let _lineCommandBuilder = LineCommandBuilder(this)
let _tokenizer = Tokenizer("", TokenizerFlags.None)
Expand Down Expand Up @@ -460,14 +462,14 @@ and [<Sealed>] internal Parser

/// Try and expand the possible abbreviation to a full line command name. If it's
/// not an abbreviation then the original string will be returned
member x.TryExpandCommandName name =
member x.TryExpandCommandName shortCommandName =

// Is 'name' an abbreviation of the given command name and abbreviation
// Is 'shortCommandName' an abbreviation of the given command name and abbreviation
let isAbbreviation (fullName: string) (abbreviation: string) =
if name = fullName then
if shortCommandName = fullName then
true
else
name.StartsWith(abbreviation) && fullName.StartsWith(name)
shortCommandName.StartsWith(abbreviation) && fullName.StartsWith(shortCommandName)

s_LineCommandNamePair
|> Seq.filter (fun (name, abbreviation) -> isAbbreviation name abbreviation)
Expand Down
4 changes: 2 additions & 2 deletions Src/VimCore/Interpreter_Parser.fsi
Expand Up @@ -12,9 +12,9 @@ type internal ParseResult<'T> =
[<Class>]
type internal Parser =

new: vimData: IVimGlobalSettings * IVimData -> Parser
new: globalSettings: IVimGlobalSettings * vimData: IVimData -> Parser

new: vimData: IVimGlobalSettings * IVimData * lines: string[] -> Parser
new: globalSettings: IVimGlobalSettings * vimData: IVimData * lines: string[] -> Parser

member IsDone: bool

Expand Down
6 changes: 4 additions & 2 deletions Src/VimCore/Interpreter_Tokenizer.fs
Expand Up @@ -193,10 +193,12 @@ type internal TokenStream() =
[<DebuggerDisplay("{ToString(),nq}")>]
type internal Tokenizer
(
_text: string,
_tokenizerFlags: TokenizerFlags
text: string,
tokenizerFlags: TokenizerFlags
) as this =

let _text = text
let _tokenizerFlags = tokenizerFlags
let _tokenStream = TokenStream()
let mutable _text = _text
let mutable _tokenizerFlags = _tokenizerFlags
Expand Down
24 changes: 12 additions & 12 deletions Src/VimCore/KeyInput.fs
Expand Up @@ -37,18 +37,18 @@ type KeyInput
/// This is demonstratable in a couple of areas. One simple one is using the
/// the CTRL-F command (scroll down). It has the same behavior with capital
/// or lower case F.
member x.CompareTo (right: KeyInput) =
if obj.ReferenceEquals(right, null) then
member x.CompareTo (other: KeyInput) =
if obj.ReferenceEquals(other, null) then
1
else
let left = x
let comp = compare left.KeyModifiers right.KeyModifiers
let comp = compare left.KeyModifiers other.KeyModifiers
if comp <> 0 then
comp
else
let comp = compare left.Char right.Char
let comp = compare left.Char other.Char
if comp <> 0 then comp
else compare left.Key right.Key
else compare left.Key other.Key

override x.GetHashCode() =
HashUtil.Combine3 (x.Char.GetHashCode()) (x.Key.GetHashCode()) (x.KeyModifiers.GetHashCode())
Expand Down Expand Up @@ -309,8 +309,8 @@ module KeyInputUtil =
| None -> invalidArg "vimKey" Resources.KeyInput_InvalidVimKey
| Some(ki) -> ki

let ChangeKeyModifiersDangerous (ki:KeyInput) keyModifiers =
KeyInput(ki.Key, keyModifiers, ki.RawChar)
let ChangeKeyModifiersDangerous (keyInput: KeyInput) modifiers =
KeyInput(keyInput.Key, modifiers, keyInput.RawChar)

let NullKey = VimKeyToKeyInput VimKey.Null
let LineFeedKey = VimKeyToKeyInput VimKey.LineFeed
Expand All @@ -321,7 +321,7 @@ module KeyInputUtil =
/// Apply the modifiers to the given KeyInput and determine the result. This will
/// not necessarily return a KeyInput with the modifier set. It attempts to unify
/// certain ambiguous combinations.
let ApplyKeyModifiers (keyInput: KeyInput) (targetModifiers: VimKeyModifiers) =
let ApplyKeyModifiers (keyInput: KeyInput) (modifiers: VimKeyModifiers) =

let normalizeToUpper (keyInput: KeyInput) =
match keyInput.RawChar with
Expand Down Expand Up @@ -395,9 +395,9 @@ module KeyInputUtil =
let modifiers = Util.UnsetFlag keyInput.KeyModifiers VimKeyModifiers.Control
ChangeKeyModifiersDangerous keyInput modifiers

let keyInput = ChangeKeyModifiersDangerous keyInput (targetModifiers ||| keyInput.KeyModifiers)
let keyInput = ChangeKeyModifiersDangerous keyInput (modifiers ||| keyInput.KeyModifiers)

if Util.IsFlagSet targetModifiers VimKeyModifiers.Alt then
if Util.IsFlagSet modifiers VimKeyModifiers.Alt then

// The alt key preserves all modifiers and converts the char to uppercase.
normalizeToUpper keyInput
Expand All @@ -406,14 +406,14 @@ module KeyInputUtil =

// First normalize the shift case.
let keyInput =
if Util.IsFlagSet targetModifiers VimKeyModifiers.Shift then
if Util.IsFlagSet modifiers VimKeyModifiers.Shift then
normalizeShift keyInput
else
keyInput

// Next normalize the control case.
let keyInput =
if Util.IsFlagSet targetModifiers VimKeyModifiers.Control then
if Util.IsFlagSet modifiers VimKeyModifiers.Control then
normalizeControl keyInput
else
keyInput
Expand Down
4 changes: 2 additions & 2 deletions Src/VimCore/KeyInput.fsi
Expand Up @@ -106,10 +106,10 @@ module KeyInputUtil =
val CharToKeyInput: c: char -> KeyInput

/// Convert the passed in char to a KeyInput with Control
val CharWithControlToKeyInput: c: char -> KeyInput
val CharWithControlToKeyInput: ch: char -> KeyInput

/// Convert the passed in char to a KeyInput with Alt
val CharWithAltToKeyInput: c: char -> KeyInput
val CharWithAltToKeyInput: ch: char -> KeyInput

/// Convert the specified VimKey code to a KeyInput
val VimKeyToKeyInput: vimKey: VimKey -> KeyInput
Expand Down
21 changes: 14 additions & 7 deletions Src/VimCore/KeyMap.fs
Expand Up @@ -206,8 +206,9 @@ type Mapper

result.Value

type internal GlobalKeyMap(_variableMap: VariableMap) =
type internal GlobalKeyMap(variableMap: VariableMap) =

let _variableMap = variableMap
let _map = MappingMap<KeyRemapMode, KeyMapping>(KeyRemapMode.All)

static member ParseKeyNotation(notation: string, variableMap: VariableMap) =
Expand Down Expand Up @@ -236,11 +237,14 @@ type internal GlobalKeyMap(_variableMap: VariableMap) =

type internal LocalKeyMap
(
_globalKeyMap: IVimGlobalKeyMap,
_globalSettings: IVimGlobalSettings,
_variableMap: VariableMap
globalKeyMap: IVimGlobalKeyMap,
globalSettings: IVimGlobalSettings,
variableMap: VariableMap
) =

let _globalKeyMap = globalKeyMap
let _globalSettings = globalSettings
let _variableMap = variableMap
let _map = MappingMap<KeyRemapMode, KeyMapping>(KeyRemapMode.All)
let mutable _isZeroMappingEnabled = true

Expand Down Expand Up @@ -310,11 +314,14 @@ type internal GlobalAbbreviationMap() =

type internal LocalAbbreviationMap
(
_keyMap: IVimLocalKeyMap,
_globalAbbreviationMap: IVimGlobalAbbreviationMap,
_wordUtil : WordUtil
keyMap: IVimLocalKeyMap,
globalAbbreviationMap: IVimGlobalAbbreviationMap,
wordUtil : WordUtil
) =

let _keyMap = keyMap
let _globalAbbreviationMap = globalAbbreviationMap
let _wordUtil = wordUtil
let _map = MappingMap<AbbreviationMode, Abbreviation>(AbbreviationMode.All)

member x.Map = _map
Expand Down
7 changes: 5 additions & 2 deletions Src/VimCore/ModeLineInterpreter.fs
Expand Up @@ -9,10 +9,13 @@ open Microsoft.VisualStudio.Text
[<Class>]
type internal ModeLineInterpreter
(
_textBuffer: ITextBuffer,
_localSettings: IVimLocalSettings
textBuffer: ITextBuffer,
localSettings: IVimLocalSettings
) =

let _textBuffer = textBuffer
let _localSettings = localSettings

/// Regular expressions to parse the modeline
static let _escapedModeLine = @"(([^:\\]|\\:?)*)"
static let _firstFormRegex = new Regex(@"[ \t]vim:(.*)$", RegexOptions.Compiled)
Expand Down
9 changes: 6 additions & 3 deletions Src/VimCore/MultiSelectionTracker.fs
Expand Up @@ -7,11 +7,14 @@ open Microsoft.VisualStudio.Text.Editor

type internal MultiSelectionTracker
(
_vimBuffer: IVimBuffer,
_commonOperations: ICommonOperations,
_mouseDevice: IMouseDevice
vimBuffer: IVimBuffer,
commonOperations: ICommonOperations,
mouseDevice: IMouseDevice
) as this =

let _vimBuffer = vimBuffer
let _commonOperations = commonOperations
let _mouseDevice = mouseDevice
let _globalSettings = _vimBuffer.GlobalSettings
let _localSettings = _vimBuffer.LocalSettings
let _vimBufferData = _vimBuffer.VimBufferData
Expand Down
12 changes: 8 additions & 4 deletions Src/VimCore/SelectionChangeTracker.fs
Expand Up @@ -17,12 +17,16 @@ open System.Collections.Generic
/// inside on
type internal SelectionChangeTracker
(
_vimBuffer: IVimBuffer,
_commonOperations: ICommonOperations,
_selectionOverrideList: IVisualModeSelectionOverride list,
_mouseDevice: IMouseDevice
vimBuffer: IVimBuffer,
commonOperations: ICommonOperations,
selectionOverrideList: IVisualModeSelectionOverride list,
mouseDevice: IMouseDevice
) as this =

let _vimBuffer = vimBuffer
let _commonOperations = commonOperations
let _selectionOverrideList = selectionOverrideList
let _mouseDevice = mouseDevice
let _globalSettings = _vimBuffer.GlobalSettings
let _textView = _vimBuffer.TextView
let _vimHost = _vimBuffer.Vim.VimHost
Expand Down
2 changes: 1 addition & 1 deletion Src/VimCore/SelectionChangeTracker.fsi
Expand Up @@ -3,4 +3,4 @@
namespace Vim

type internal SelectionChangeTracker =
new: vimBuffer: IVimBuffer * commonOperations: ICommonOperations * visualModeSelectionOverrideList: IVisualModeSelectionOverride list * mouseDevice: IMouseDevice -> SelectionChangeTracker
new: vimBuffer: IVimBuffer * commonOperations: ICommonOperations * selectionOverrideList: IVisualModeSelectionOverride list * mouseDevice: IMouseDevice -> SelectionChangeTracker
7 changes: 5 additions & 2 deletions Src/VimCore/TextObjectUtil.fs
Expand Up @@ -44,10 +44,13 @@ type internal SectionKind =

type internal TextObjectUtil
(
_globalSettings: IVimGlobalSettings,
_textBuffer: ITextBuffer
globalSettings: IVimGlobalSettings,
textBuffer: ITextBuffer
) =

let _globalSettings = globalSettings
let _textBuffer = textBuffer

/// List of characters which represent the end of a sentence.
static let SentenceEndChars = ['.'; '!'; '?']

Expand Down

0 comments on commit f47ea16

Please sign in to comment.