Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
52276538
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,发现更多精彩内容 >>
提交
52276538
编写于
10月 08, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tsfmt - extensions/php
上级
69a30b65
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
38 addition
and
38 deletion
+38
-38
extensions/php/src/features/completionItemProvider.ts
extensions/php/src/features/completionItemProvider.ts
+12
-12
extensions/php/src/features/hoverProvider.ts
extensions/php/src/features/hoverProvider.ts
+2
-2
extensions/php/src/features/phpGlobals.ts
extensions/php/src/features/phpGlobals.ts
+2
-2
extensions/php/src/features/signatureHelpProvider.ts
extensions/php/src/features/signatureHelpProvider.ts
+10
-10
extensions/php/src/features/utils/markedTextUtil.ts
extensions/php/src/features/utils/markedTextUtil.ts
+2
-2
extensions/php/src/features/validationProvider.ts
extensions/php/src/features/validationProvider.ts
+3
-3
extensions/php/src/phpMain.ts
extensions/php/src/phpMain.ts
+1
-1
extensions/php/typings/mocha.d.ts
extensions/php/typings/mocha.d.ts
+6
-6
未找到文件。
extensions/php/src/features/completionItemProvider.ts
浏览文件 @
52276538
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
CompletionItemProvider
,
CompletionItem
,
CompletionItemKind
,
CancellationToken
,
TextDocument
,
Position
,
Range
,
TextEdit
}
from
'
vscode
'
;
import
{
CompletionItemProvider
,
CompletionItem
,
CompletionItemKind
,
CancellationToken
,
TextDocument
,
Position
,
Range
,
TextEdit
}
from
'
vscode
'
;
import
phpGlobals
=
require
(
'
./phpGlobals
'
);
export
default
class
PHPCompletionItemProvider
implements
CompletionItemProvider
{
...
...
@@ -14,19 +14,19 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
public
provideCompletionItems
(
document
:
TextDocument
,
position
:
Position
,
token
:
CancellationToken
):
Promise
<
CompletionItem
[]
>
{
let
result
:
CompletionItem
[]
=
[];
var
range
=
document
.
getWordRangeAtPosition
(
position
);
var
range
=
document
.
getWordRangeAtPosition
(
position
);
var
prefix
=
range
?
document
.
getText
(
range
)
:
''
;
if
(
!
range
)
{
range
=
new
Range
(
position
,
position
);
}
var
added
:
any
=
{};
var
createNewProposal
=
function
(
kind
:
CompletionItemKind
,
name
:
string
,
entry
:
phpGlobals
.
IEntry
)
:
CompletionItem
{
var
proposal
:
CompletionItem
=
new
CompletionItem
(
name
);
var
added
:
any
=
{};
var
createNewProposal
=
function
(
kind
:
CompletionItemKind
,
name
:
string
,
entry
:
phpGlobals
.
IEntry
):
CompletionItem
{
var
proposal
:
CompletionItem
=
new
CompletionItem
(
name
);
proposal
.
kind
=
kind
;
if
(
entry
)
{
if
(
entry
.
description
)
{
proposal
.
documentation
=
entry
.
description
;
proposal
.
documentation
=
entry
.
description
;
}
if
(
entry
.
signature
)
{
proposal
.
detail
=
entry
.
signature
;
...
...
@@ -35,14 +35,14 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
return
proposal
;
};
var
matches
=
(
name
:
string
)
=>
{
var
matches
=
(
name
:
string
)
=>
{
return
prefix
.
length
===
0
||
name
.
length
>=
prefix
.
length
&&
name
.
substr
(
0
,
prefix
.
length
)
===
prefix
;
};
if
(
matches
(
'
php
'
)
&&
range
.
start
.
character
>=
2
)
{
let
twoBeforePosition
=
new
Position
(
range
.
start
.
line
,
range
.
start
.
character
-
2
);
let
beforeWord
=
document
.
getText
(
new
Range
(
twoBeforePosition
,
range
.
start
));
if
(
beforeWord
===
'
<?
'
)
{
let
proposal
=
createNewProposal
(
CompletionItemKind
.
Class
,
'
<?php
'
,
null
);
proposal
.
textEdit
=
new
TextEdit
(
new
Range
(
twoBeforePosition
,
position
),
'
<?php
'
);
...
...
@@ -79,7 +79,7 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
var
text
=
document
.
getText
();
if
(
prefix
[
0
]
===
'
$
'
)
{
var
variableMatch
=
/
\$([
a-zA-Z_
\x
7f-
\x
ff
][
a-zA-Z0-9_
\x
7f-
\x
ff
]
*
)
/g
;
var
match
:
RegExpExecArray
=
null
;
var
match
:
RegExpExecArray
=
null
;
while
(
match
=
variableMatch
.
exec
(
text
))
{
var
word
=
match
[
0
];
if
(
!
added
[
word
])
{
...
...
@@ -89,7 +89,7 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
}
}
var
functionMatch
=
/function
\s
+
([
a-zA-Z_
\x
7f-
\x
ff
][
a-zA-Z0-9_
\x
7f-
\x
ff
]
*
)\s
*
\(
/g
;
var
match
:
RegExpExecArray
=
null
;
var
match
:
RegExpExecArray
=
null
;
while
(
match
=
functionMatch
.
exec
(
text
))
{
var
word
=
match
[
1
];
if
(
!
added
[
word
])
{
...
...
extensions/php/src/features/hoverProvider.ts
浏览文件 @
52276538
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
HoverProvider
,
Hover
,
MarkedString
,
TextDocument
,
CancellationToken
,
Position
}
from
'
vscode
'
;
import
{
HoverProvider
,
Hover
,
MarkedString
,
TextDocument
,
CancellationToken
,
Position
}
from
'
vscode
'
;
import
phpGlobals
=
require
(
'
./phpGlobals
'
);
import
{
textToMarkedString
}
from
'
./utils/markedTextUtil
'
;
...
...
@@ -22,7 +22,7 @@ export default class PHPHoverProvider implements HoverProvider {
var
entry
=
phpGlobals
.
globalfunctions
[
name
]
||
phpGlobals
.
compiletimeconstants
[
name
]
||
phpGlobals
.
globalvariables
[
name
]
||
phpGlobals
.
keywords
[
name
];
if
(
entry
&&
entry
.
description
)
{
let
signature
=
name
+
(
entry
.
signature
||
''
);
let
contents
:
MarkedString
[]
=
[
textToMarkedString
(
entry
.
description
),
{
language
:
'
php
'
,
value
:
signature
}];
let
contents
:
MarkedString
[]
=
[
textToMarkedString
(
entry
.
description
),
{
language
:
'
php
'
,
value
:
signature
}];
return
new
Hover
(
contents
,
wordRange
);
}
}
...
...
extensions/php/src/features/phpGlobals.ts
浏览文件 @
52276538
...
...
@@ -6,7 +6,7 @@
// file generated from PHP53Schema.xml using php-exclude_generate_php_globals.js
export
interface
IEntry
{
description
?:
string
;
signature
?:
string
;
}
export
interface
IEntries
{
[
name
:
string
]:
IEntry
;
}
export
interface
IEntries
{
[
name
:
string
]:
IEntry
;
}
export
var
globalfunctions
:
IEntries
=
{
password_get_info
:
{
...
...
@@ -1950,7 +1950,7 @@ export var globalfunctions: IEntries = {
signature
:
'
(string $str): string
'
},
urldecode
:
{
description
:
'
Decodes any %## encoding in the given string. Plus symbols (
'
+
'
) are decoded to a space character.
'
,
description
:
'
Decodes any %## encoding in the given string. Plus symbols (
'
+
'
) are decoded to a space character.
'
,
signature
:
'
(string $str): string
'
},
rawurlencode
:
{
...
...
extensions/php/src/features/signatureHelpProvider.ts
浏览文件 @
52276538
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
SignatureHelpProvider
,
SignatureHelp
,
SignatureInformation
,
CancellationToken
,
TextDocument
,
Position
}
from
'
vscode
'
;
import
{
SignatureHelpProvider
,
SignatureHelp
,
SignatureInformation
,
CancellationToken
,
TextDocument
,
Position
}
from
'
vscode
'
;
import
phpGlobals
=
require
(
'
./phpGlobals
'
);
var
_NL
=
'
\n
'
.
charCodeAt
(
0
);
...
...
@@ -35,7 +35,7 @@ class BackwardIterator {
private
lineNumber
:
number
;
private
offset
:
number
;
private
line
:
string
;
private
model
:
TextDocument
;
private
model
:
TextDocument
;
constructor
(
model
:
TextDocument
,
offset
:
number
,
lineNumber
:
number
)
{
this
.
lineNumber
=
lineNumber
;
...
...
@@ -44,11 +44,11 @@ class BackwardIterator {
this
.
model
=
model
;
}
public
hasNext
()
:
boolean
{
public
hasNext
():
boolean
{
return
this
.
lineNumber
>=
0
;
}
public
next
()
:
number
{
public
next
():
number
{
if
(
this
.
offset
<
0
)
{
if
(
this
.
lineNumber
>
0
)
{
this
.
lineNumber
--
;
...
...
@@ -92,7 +92,7 @@ export default class PHPSignatureHelpProvider implements SignatureHelpProvider {
var
re
=
/
\w
*
\s
+
\&?\$[\w
_
\.]
+|void/g
;
var
match
:
RegExpExecArray
=
null
;
while
((
match
=
re
.
exec
(
paramsString
))
!==
null
)
{
signatureInfo
.
parameters
.
push
({
label
:
match
[
0
],
documentation
:
''
});
signatureInfo
.
parameters
.
push
({
label
:
match
[
0
],
documentation
:
''
});
}
let
ret
=
new
SignatureHelp
();
ret
.
signatures
.
push
(
signatureInfo
);
...
...
@@ -101,7 +101,7 @@ export default class PHPSignatureHelpProvider implements SignatureHelpProvider {
return
Promise
.
resolve
(
ret
);
}
private
readArguments
(
iterator
:
BackwardIterator
)
:
number
{
private
readArguments
(
iterator
:
BackwardIterator
):
number
{
var
parentNesting
=
0
;
var
bracketNesting
=
0
;
var
curlyNesting
=
0
;
...
...
@@ -136,8 +136,8 @@ export default class PHPSignatureHelpProvider implements SignatureHelpProvider {
return
-
1
;
}
private
isIdentPart
(
ch
:
number
)
:
boolean
{
if
(
ch
===
_USC
||
// _
private
isIdentPart
(
ch
:
number
)
:
boolean
{
if
(
ch
===
_USC
||
// _
ch
>=
_a
&&
ch
<=
_z
||
// a-z
ch
>=
_A
&&
ch
<=
_Z
||
// A-Z
ch
>=
_0
&&
ch
<=
_9
||
// 0/9
...
...
@@ -148,7 +148,7 @@ export default class PHPSignatureHelpProvider implements SignatureHelpProvider {
return
false
;
}
private
readIdent
(
iterator
:
BackwardIterator
)
:
string
{
private
readIdent
(
iterator
:
BackwardIterator
):
string
{
var
identStarted
=
false
;
var
ident
=
''
;
while
(
iterator
.
hasNext
())
{
...
...
@@ -158,7 +158,7 @@ export default class PHPSignatureHelpProvider implements SignatureHelpProvider {
}
if
(
this
.
isIdentPart
(
ch
))
{
identStarted
=
true
;
ident
=
String
.
fromCharCode
(
ch
)
+
ident
;
ident
=
String
.
fromCharCode
(
ch
)
+
ident
;
}
else
if
(
identStarted
)
{
return
ident
;
}
...
...
extensions/php/src/features/utils/markedTextUtil.ts
浏览文件 @
52276538
...
...
@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
MarkedString
}
from
'
vscode
'
;
import
{
MarkedString
}
from
'
vscode
'
;
export
function
textToMarkedString
(
text
:
string
)
:
MarkedString
{
export
function
textToMarkedString
(
text
:
string
):
MarkedString
{
return
text
.
replace
(
/
[\\
`*_{}[
\]
()#+
\-
.!
]
/g
,
'
\\
$&
'
);
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
}
\ No newline at end of file
extensions/php/src/features/validationProvider.ts
浏览文件 @
52276538
...
...
@@ -70,7 +70,7 @@ namespace RunTrigger {
onSave
:
'
onSave
'
,
onType
:
'
onType
'
};
export
let
from
=
function
(
value
:
string
):
RunTrigger
{
export
let
from
=
function
(
value
:
string
):
RunTrigger
{
if
(
value
===
'
onType
'
)
{
return
RunTrigger
.
onType
;
}
else
{
...
...
@@ -108,7 +108,7 @@ export default class PHPValidationProvider {
this
.
loadConfiguration
();
vscode
.
workspace
.
onDidOpenTextDocument
(
this
.
triggerValidate
,
this
,
subscriptions
);
vscode
.
workspace
.
onDidCloseTextDocument
((
textDocument
)
=>
{
vscode
.
workspace
.
onDidCloseTextDocument
((
textDocument
)
=>
{
this
.
diagnosticCollection
.
delete
(
textDocument
.
uri
);
delete
this
.
delayers
[
textDocument
.
uri
.
toString
()];
},
null
,
subscriptions
);
...
...
@@ -158,7 +158,7 @@ export default class PHPValidationProvider {
delayer
=
new
ThrottledDelayer
<
void
>
(
this
.
trigger
===
RunTrigger
.
onType
?
250
:
0
);
this
.
delayers
[
key
]
=
delayer
;
}
delayer
.
trigger
(()
=>
this
.
doValidate
(
textDocument
)
);
delayer
.
trigger
(()
=>
this
.
doValidate
(
textDocument
));
}
private
doValidate
(
textDocument
:
vscode
.
TextDocument
):
Promise
<
void
>
{
...
...
extensions/php/src/phpMain.ts
浏览文件 @
52276538
...
...
@@ -14,7 +14,7 @@ import { ExtensionContext, languages, env } from 'vscode';
import
*
as
nls
from
'
vscode-nls
'
;
export
function
activate
(
context
:
ExtensionContext
):
any
{
nls
.
config
({
locale
:
env
.
language
});
nls
.
config
({
locale
:
env
.
language
});
// add providers
context
.
subscriptions
.
push
(
languages
.
registerCompletionItemProvider
(
'
php
'
,
new
PHPCompletionItemProvider
(),
'
.
'
,
'
$
'
));
...
...
extensions/php/typings/mocha.d.ts
浏览文件 @
52276538
...
...
@@ -5,9 +5,9 @@
declare
function
run
():
void
;
declare
function
suite
(
name
:
string
,
fn
:
(
err
?)
=>
void
);
declare
function
test
(
name
:
string
,
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
suiteSetup
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
suiteTeardown
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
setup
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
teardown
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
suite
(
name
:
string
,
fn
:
(
err
?)
=>
void
);
declare
function
test
(
name
:
string
,
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
suiteSetup
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
suiteTeardown
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
setup
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
teardown
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录