Skip to content

Commit 642a0e0

Browse files
vushuWebFreak001
authored andcommitted
minor adjustments
1 parent 78740cc commit 642a0e0

File tree

5 files changed

+16
-73
lines changed

5 files changed

+16
-73
lines changed

src/dcd/server/autocomplete/calltip_utils.d

-40
This file was deleted.

src/dcd/server/autocomplete/complete.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ AutocompleteResponse dotCompletion(T)(T beforeTokens, const(Token)[] tokenArray,
202202
}
203203
else if (beforeTokens.length >= 2 && beforeTokens[$ - 1] == tok!".")
204204
significantTokenType = beforeTokens[$ - 2].type;
205-
else
205+
else
206206
return response;
207207

208208
switch (significantTokenType)

src/dcd/server/autocomplete/ufcs.d

+3-6
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ import dsymbol.builtin.names;
1212
import std.string;
1313
import dparse.lexer : tok;
1414
import std.regex;
15-
import dcd.server.autocomplete.calltip_utils;
1615
import containers.hashset : HashSet;
17-
import std.experimental.logger;
18-
import std.algorithm.iteration : map;
1916

2017
void lookupUFCS(Scope* completionScope, DSymbol* beforeDotSymbol, size_t cursorPosition, ref AutocompleteResponse response)
2118
{
@@ -26,8 +23,7 @@ void lookupUFCS(Scope* completionScope, DSymbol* beforeDotSymbol, size_t cursorP
2623

2724
AutocompleteResponse.Completion createCompletionForUFCS(const DSymbol* symbol)
2825
{
29-
return AutocompleteResponse.Completion(symbol.name, symbol.kind, "(UFCS) " ~ removeFirstArgumentOfFunction(
30-
symbol.callTip), symbol
26+
return AutocompleteResponse.Completion(symbol.name, symbol.kind, "(UFCS) " ~ symbol.callTip, symbol
3127
.symbolFile, symbol
3228
.location, symbol
3329
.doc);
@@ -59,7 +55,8 @@ bool isInvalidForUFCSCompletion(const(DSymbol)* beforeDotSymbol)
5955
*/
6056
DSymbol*[] getSymbolsForUFCS(Scope* completionScope, const(DSymbol)* beforeDotSymbol, size_t cursorPosition)
6157
{
62-
if (beforeDotSymbol.isInvalidForUFCSCompletion) {
58+
if (beforeDotSymbol.isInvalidForUFCSCompletion)
59+
{
6360
return null;
6461
}
6562

src/dcd/server/autocomplete/util.d

+4-5
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,10 @@ SymbolStuff getSymbolsForCompletion(const AutocompleteRequest request,
146146
auto expression = getExpression(beforeTokens);
147147
auto symbols = getSymbolsByTokenChain(pair.scope_, expression,
148148
request.cursorPosition, type);
149-
if (symbols.length == 0 && doUFCSSearch(stringToken(beforeTokens.front), stringToken(beforeTokens.back))) {
150-
// Let search for UFCS, since we got no hit
151-
symbols ~= getSymbolsByTokenChain(pair.scope_, getExpression([beforeTokens.back]),
152-
request.cursorPosition, type);
153-
}
149+
if (symbols.length == 0 && doUFCSSearch(stringToken(beforeTokens.front), stringToken(beforeTokens.back))) {
150+
// Let search for UFCS, since we got no hit
151+
symbols ~= getSymbolsByTokenChain(pair.scope_, getExpression([beforeTokens.back]), request.cursorPosition, type);
152+
}
154153
return SymbolStuff(symbols, pair.symbol, pair.scope_);
155154
}
156155

+8-21
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
11
module fooutils;
22

33
struct Foo {
4-
void fooHey(){ }
4+
void fooHey(){}
55
}
66

7-
void u(Foo foo) {
8-
}
9-
10-
void ufcsHello(ref Foo foo)
11-
{
12-
}
13-
14-
void ufcsBar(Foo foo, string mama)
15-
{
16-
}
17-
18-
void ufcsBarRef(ref Foo foo, string mama)
19-
{
20-
}
21-
22-
void ufcsBarRefConst(ref const Foo foo, string mama)
23-
{
24-
}
7+
void u(Foo foo) {}
8+
void ufcsHello(ref Foo foo) {}
9+
void ufcsBar(Foo foo, string mama) {}
10+
void ufcsBarRef(ref Foo foo, string mama) {}
11+
void ufcsBarRefConst(ref const Foo foo, string mama) {}
2512
void ufcsBarRefConstWrapped(ref const(Foo) foo, string mama) {}
2613
void ufcsBarRefImmuttableWrapped(ref immutable(Foo) foo, string mama) {}
2714
void ufcsBarScope(ref scope Foo foo, string mama) {}
2815
void ufcsBarReturnScope(return scope Foo foo, string mama) {}
29-
private void privateUfcsBar(Foo foo, string message) {}
30-
void notUfcsBar(string message) {}
16+
private void ufcsBarPrivate(Foo foo, string message) {}
17+
void helloBar(string message) {}

0 commit comments

Comments
 (0)