提交 a0147017 编写于 作者: A Alex Dima

Add `editor.wordSeparators` option

上级 940c8d43
......@@ -66,6 +66,7 @@ function cloneInternalEditorOptions(opts: editorCommon.IInternalEditorOptions):
return {
experimentalScreenReader: opts.experimentalScreenReader,
rulers: opts.rulers.slice(0),
wordSeparators: opts.wordSeparators,
ariaLabel: opts.ariaLabel,
lineNumbers: opts.lineNumbers,
selectOnLineNumbers: opts.selectOnLineNumbers,
......@@ -279,6 +280,7 @@ class InternalEditorOptionsHelper {
cursorBlinking: opts.cursorBlinking,
experimentalScreenReader: toBoolean(opts.experimentalScreenReader),
rulers: toSortedIntegerArray(opts.rulers),
wordSeparators: String(opts.wordSeparators),
ariaLabel: String(opts.ariaLabel),
cursorStyle: opts.cursorStyle,
fontLigatures: toBoolean(opts.fontLigatures),
......@@ -360,6 +362,7 @@ class InternalEditorOptionsHelper {
return {
experimentalScreenReader: (prevOpts.experimentalScreenReader !== newOpts.experimentalScreenReader),
rulers: (!this._numberArraysEqual(prevOpts.rulers, newOpts.rulers)),
wordSeparators: (prevOpts.wordSeparators !== newOpts.wordSeparators),
ariaLabel: (prevOpts.ariaLabel !== newOpts.ariaLabel),
lineNumbers: (prevOpts.lineNumbers !== newOpts.lineNumbers),
......@@ -876,6 +879,11 @@ configurationRegistry.registerConfiguration({
'default': DefaultConfig.editor.rulers,
'description': nls.localize('rulers', "Columns at which to show vertical rulers")
},
'editor.wordSeparators' : {
'type': 'string',
'default': DefaultConfig.editor.wordSeparators,
'description': nls.localize('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations")
},
'editor.tabSize' : {
'oneOf': [
{
......
......@@ -11,6 +11,8 @@ export interface IConfiguration {
editor:IEditorOptions;
}
export const USUAL_WORD_SEPARATORS = '`~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?';
class ConfigClass implements IConfiguration {
public editor: IEditorOptions;
......@@ -19,6 +21,7 @@ class ConfigClass implements IConfiguration {
this.editor = {
experimentalScreenReader: false,
rulers: [],
wordSeparators: USUAL_WORD_SEPARATORS,
ariaLabel: nls.localize('editorViewAccessibleLabel', "Editor content"),
lineNumbers: true,
selectOnLineNumbers: true,
......
......@@ -279,6 +279,11 @@ export interface IEditorOptions {
* Defaults to empty array.
*/
rulers?: number[];
/**
* A string containing the word separators used when doing word navigation.
* Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?
*/
wordSeparators?: string;
/**
* Control the rendering of line numbers.
* If it is a function, it will be invoked when rendering a line number and the return value will be rendered.
......@@ -591,6 +596,7 @@ export interface IEditorWrappingInfo {
export interface IInternalEditorOptions {
experimentalScreenReader: boolean;
rulers: number[];
wordSeparators: string;
ariaLabel: string;
// ---- Options that are transparent - get no massaging
......@@ -679,6 +685,7 @@ export interface IInternalEditorOptions {
export interface IConfigurationChangedEvent {
experimentalScreenReader: boolean;
rulers: boolean;
wordSeparators: boolean;
ariaLabel: boolean;
// ---- Options that are transparent - get no massaging
......
......@@ -5,6 +5,7 @@
'use strict';
import * as modes from 'vs/editor/common/modes';
import {USUAL_WORD_SEPARATORS} from 'vs/editor/common/config/defaultConfig';
export class NullState implements modes.IState {
......@@ -63,7 +64,7 @@ export class NullMode implements modes.IMode {
* /(-?\d*\.\d\w*)|([^\`\~\!\@\#\$\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
*/
public static createWordRegExp(allowInWords:string = ''): RegExp {
var usualSeparators = '`~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?';
var usualSeparators = USUAL_WORD_SEPARATORS;
var source = '(-?\\d*\\.\\d\\w*)|([^';
for (var i = 0; i < usualSeparators.length; i++) {
if (allowInWords.indexOf(usualSeparators[i]) >= 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册