Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c1eb07f7
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c1eb07f7
编写于
10月 25, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove ITextModel.getIndentLevel
上级
e031b094
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
23 deletion
+28
-23
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+0
-5
src/vs/editor/common/model/indentRanges.ts
src/vs/editor/common/model/indentRanges.ts
+10
-3
src/vs/editor/common/model/modelLine.ts
src/vs/editor/common/model/modelLine.ts
+14
-5
src/vs/editor/common/model/textModel.ts
src/vs/editor/common/model/textModel.ts
+0
-9
src/vs/editor/contrib/quickFix/browser/lightBulbWidget.ts
src/vs/editor/contrib/quickFix/browser/lightBulbWidget.ts
+4
-1
未找到文件。
src/vs/editor/common/editorCommon.ts
浏览文件 @
c1eb07f7
...
@@ -587,11 +587,6 @@ export interface ITextModel {
...
@@ -587,11 +587,6 @@ export interface ITextModel {
*/
*/
getLinesContent
():
string
[];
getLinesContent
():
string
[];
/**
* @internal
*/
getIndentLevel
(
lineNumber
:
number
):
number
;
/**
/**
* Get the end of line sequence predominantly used in the text buffer.
* Get the end of line sequence predominantly used in the text buffer.
* @return EOL char sequence (e.g.: '\n' or '\r\n').
* @return EOL char sequence (e.g.: '\n' or '\r\n').
...
...
src/vs/editor/common/model/indentRanges.ts
浏览文件 @
c1eb07f7
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
import
{
ITextModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ITextModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
FoldingMarkers
}
from
'
vs/editor/common/modes/languageConfiguration
'
;
import
{
FoldingMarkers
}
from
'
vs/editor/common/modes/languageConfiguration
'
;
import
{
computeIndentLevel
}
from
'
vs/editor/common/model/modelLine
'
;
export
const
MAX_FOLDING_REGIONS
=
0xFFFF
;
export
const
MAX_FOLDING_REGIONS
=
0xFFFF
;
...
@@ -78,7 +79,10 @@ export class IndentRanges {
...
@@ -78,7 +79,10 @@ export class IndentRanges {
}
}
public
getIndent
(
index
:
number
)
{
public
getIndent
(
index
:
number
)
{
return
this
.
_model
.
getIndentLevel
(
this
.
getStartLineNumber
(
index
));
const
lineNumber
=
this
.
getStartLineNumber
(
index
);
const
tabSize
=
this
.
_model
.
getOptions
().
tabSize
;
const
lineContent
=
this
.
_model
.
getLineContent
(
lineNumber
);
return
computeIndentLevel
(
lineContent
,
tabSize
);
}
}
public
contains
(
index
:
number
,
line
:
number
)
{
public
contains
(
index
:
number
,
line
:
number
)
{
...
@@ -181,6 +185,8 @@ interface PreviousRegion { indent: number; line: number; marker: boolean; };
...
@@ -181,6 +185,8 @@ interface PreviousRegion { indent: number; line: number; marker: boolean; };
export
function
computeRanges
(
model
:
ITextModel
,
offSide
:
boolean
,
markers
?:
FoldingMarkers
,
minimumRangeSize
:
number
=
1
):
IndentRanges
{
export
function
computeRanges
(
model
:
ITextModel
,
offSide
:
boolean
,
markers
?:
FoldingMarkers
,
minimumRangeSize
:
number
=
1
):
IndentRanges
{
const
tabSize
=
model
.
getOptions
().
tabSize
;
let
result
=
new
RangesCollector
();
let
result
=
new
RangesCollector
();
let
pattern
=
void
0
;
let
pattern
=
void
0
;
...
@@ -192,7 +198,8 @@ export function computeRanges(model: ITextModel, offSide: boolean, markers?: Fol
...
@@ -192,7 +198,8 @@ export function computeRanges(model: ITextModel, offSide: boolean, markers?: Fol
previousRegions
.
push
({
indent
:
-
1
,
line
:
model
.
getLineCount
()
+
1
,
marker
:
false
});
// sentinel, to make sure there's at least one entry
previousRegions
.
push
({
indent
:
-
1
,
line
:
model
.
getLineCount
()
+
1
,
marker
:
false
});
// sentinel, to make sure there's at least one entry
for
(
let
line
=
model
.
getLineCount
();
line
>
0
;
line
--
)
{
for
(
let
line
=
model
.
getLineCount
();
line
>
0
;
line
--
)
{
let
indent
=
model
.
getIndentLevel
(
line
);
let
lineContent
=
model
.
getLineContent
(
line
);
let
indent
=
computeIndentLevel
(
lineContent
,
tabSize
);
let
previous
=
previousRegions
[
previousRegions
.
length
-
1
];
let
previous
=
previousRegions
[
previousRegions
.
length
-
1
];
if
(
indent
===
-
1
)
{
if
(
indent
===
-
1
)
{
if
(
offSide
&&
!
previous
.
marker
)
{
if
(
offSide
&&
!
previous
.
marker
)
{
...
@@ -202,7 +209,7 @@ export function computeRanges(model: ITextModel, offSide: boolean, markers?: Fol
...
@@ -202,7 +209,7 @@ export function computeRanges(model: ITextModel, offSide: boolean, markers?: Fol
continue
;
// only whitespace
continue
;
// only whitespace
}
}
let
m
;
let
m
;
if
(
pattern
&&
(
m
=
model
.
getLineContent
(
line
)
.
match
(
pattern
)))
{
if
(
pattern
&&
(
m
=
lineContent
.
match
(
pattern
)))
{
// folding pattern match
// folding pattern match
if
(
m
[
1
])
{
// start pattern match
if
(
m
[
1
])
{
// start pattern match
// discard all regions until the folding pattern
// discard all regions until the folding pattern
...
...
src/vs/editor/common/model/modelLine.ts
浏览文件 @
c1eb07f7
...
@@ -27,10 +27,10 @@ var NO_OP_TOKENS_ADJUSTER: ITokensAdjuster = {
...
@@ -27,10 +27,10 @@ var NO_OP_TOKENS_ADJUSTER: ITokensAdjuster = {
/**
/**
* Returns:
* Returns:
* -
0
=> the line consists of whitespace
* -
-1
=> the line consists of whitespace
* - otherwise => the indent level is returned value
- 1
* - otherwise => the indent level is returned value
*/
*/
function
computePlusOn
eIndentLevel
(
line
:
string
,
tabSize
:
number
):
number
{
export
function
comput
eIndentLevel
(
line
:
string
,
tabSize
:
number
):
number
{
let
indent
=
0
;
let
indent
=
0
;
let
i
=
0
;
let
i
=
0
;
let
len
=
line
.
length
;
let
len
=
line
.
length
;
...
@@ -48,10 +48,19 @@ function computePlusOneIndentLevel(line: string, tabSize: number): number {
...
@@ -48,10 +48,19 @@ function computePlusOneIndentLevel(line: string, tabSize: number): number {
}
}
if
(
i
===
len
)
{
if
(
i
===
len
)
{
return
0
;
// line only consists of whitespace
return
-
1
;
// line only consists of whitespace
}
}
return
indent
+
1
;
return
indent
;
}
/**
* Returns:
* - 0 => the line consists of whitespace
* - otherwise => the indent level is returned value - 1
*/
function
computePlusOneIndentLevel
(
line
:
string
,
tabSize
:
number
):
number
{
return
computeIndentLevel
(
line
,
tabSize
)
+
1
;
}
}
export
interface
IModelLine
{
export
interface
IModelLine
{
...
...
src/vs/editor/common/model/textModel.ts
浏览文件 @
c1eb07f7
...
@@ -487,15 +487,6 @@ export class TextModel implements editorCommon.ITextModel {
...
@@ -487,15 +487,6 @@ export class TextModel implements editorCommon.ITextModel {
return
this
.
_lines
[
lineNumber
-
1
].
text
;
return
this
.
_lines
[
lineNumber
-
1
].
text
;
}
}
public
getIndentLevel
(
lineNumber
:
number
):
number
{
this
.
_assertNotDisposed
();
if
(
lineNumber
<
1
||
lineNumber
>
this
.
getLineCount
())
{
throw
new
Error
(
'
Illegal value
'
+
lineNumber
+
'
for `lineNumber`
'
);
}
return
this
.
_lines
[
lineNumber
-
1
].
getIndentLevel
();
}
public
getLinesContent
():
string
[]
{
public
getLinesContent
():
string
[]
{
this
.
_assertNotDisposed
();
this
.
_assertNotDisposed
();
var
r
:
string
[]
=
[];
var
r
:
string
[]
=
[];
...
...
src/vs/editor/contrib/quickFix/browser/lightBulbWidget.ts
浏览文件 @
c1eb07f7
...
@@ -12,6 +12,7 @@ import { GlobalMouseMoveMonitor, IStandardMouseMoveEventData, standardMouseMoveM
...
@@ -12,6 +12,7 @@ import { GlobalMouseMoveMonitor, IStandardMouseMoveEventData, standardMouseMoveM
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
ICodeEditor
,
IContentWidget
,
IContentWidgetPosition
,
ContentWidgetPositionPreference
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
,
IContentWidget
,
IContentWidgetPosition
,
ContentWidgetPositionPreference
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
QuickFixComputeEvent
}
from
'
./quickFixModel
'
;
import
{
QuickFixComputeEvent
}
from
'
./quickFixModel
'
;
import
{
computeIndentLevel
}
from
'
vs/editor/common/model/modelLine
'
;
export
class
LightBulbWidget
implements
IDisposable
,
IContentWidget
{
export
class
LightBulbWidget
implements
IDisposable
,
IContentWidget
{
...
@@ -138,7 +139,9 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
...
@@ -138,7 +139,9 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
}
}
const
{
lineNumber
}
=
this
.
_model
.
position
;
const
{
lineNumber
}
=
this
.
_model
.
position
;
const
model
=
this
.
_editor
.
getModel
();
const
model
=
this
.
_editor
.
getModel
();
const
indent
=
model
.
getIndentLevel
(
lineNumber
);
const
tabSize
=
model
.
getOptions
().
tabSize
;
const
lineContent
=
model
.
getLineContent
(
lineNumber
);
const
indent
=
computeIndentLevel
(
lineContent
,
tabSize
);
const
lineHasSpace
=
config
.
fontInfo
.
spaceWidth
*
indent
>
22
;
const
lineHasSpace
=
config
.
fontInfo
.
spaceWidth
*
indent
>
22
;
let
effectiveLineNumber
=
lineNumber
;
let
effectiveLineNumber
=
lineNumber
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录