提交 b4c8ae24 编写于 作者: S Sandeep Somavarapu

#6754 fix intellisense for css variables to get triggerred only for first...

#6754 fix intellisense for css variables to get triggerred only for first argument of a var function
上级 cbc931db
...@@ -1005,7 +1005,7 @@ export class Parser { ...@@ -1005,7 +1005,7 @@ export class Parser {
if (node.getArguments().addChild(this._parseFunctionArgument())) { if (node.getArguments().addChild(this._parseFunctionArgument())) {
while (this.accept(scanner.TokenType.Comma)) { while (this.accept(scanner.TokenType.Comma)) {
if (!node.getArguments().addChild(this._parseFunctionArgument())) { if (!node.getArguments().addChild(this._parseFunctionArgument())) {
return this.finish(node, errors.ParseError.ExpressionExpected); this.markError(node, errors.ParseError.ExpressionExpected);
} }
} }
} }
......
...@@ -74,14 +74,11 @@ export class CSSIntellisense { ...@@ -74,14 +74,11 @@ export class CSSIntellisense {
} else if (node instanceof nodes.Interpolation) { } else if (node instanceof nodes.Interpolation) {
this.getCompletionsForInterpolation(<nodes.Interpolation> node, result); this.getCompletionsForInterpolation(<nodes.Interpolation> node, result);
} else if (node instanceof nodes.FunctionArgument) { } else if (node instanceof nodes.FunctionArgument) {
this.getCompletionsForFunctionArguments(<nodes.FunctionArgument> node, result); this.getCompletionsForFunctionArgument(<nodes.FunctionArgument> node, <nodes.Function>node.getParent(), result);
} else if (node instanceof nodes.FunctionDeclaration) { } else if (node instanceof nodes.FunctionDeclaration) {
this.getCompletionsForFunctionDeclaration(<nodes.FunctionDeclaration> node, result); this.getCompletionsForFunctionDeclaration(<nodes.FunctionDeclaration> node, result);
} else if (node instanceof nodes.Function) { } else if (node instanceof nodes.Function) {
let functionNode: nodes.Function= <nodes.Function>node; this.getCompletionsForFunctionArgument(null, <nodes.Function>node, result);
if (functionNode.getIdentifier().getText() === 'var') {
this.getVariableProposalsForCSSVarFunction(result);
}
} }
if (result.length > 0) { if (result.length > 0) {
return { currentWord: this.currentWord, suggestions: result, incomplete: this.isIncomplete }; return { currentWord: this.currentWord, suggestions: result, incomplete: this.isIncomplete };
...@@ -547,6 +544,11 @@ export class CSSIntellisense { ...@@ -547,6 +544,11 @@ export class CSSIntellisense {
} }
public getCompletionsForExpression(expression: nodes.Expression, result:Modes.ISuggestion[]):Modes.ISuggestion[]{ public getCompletionsForExpression(expression: nodes.Expression, result:Modes.ISuggestion[]):Modes.ISuggestion[]{
if (expression.getParent() instanceof nodes.FunctionArgument) {
this.getCompletionsForFunctionArgument(<nodes.FunctionArgument>expression.getParent(), <nodes.Function>expression.getParent().getParent(), result);
return result;
}
var declaration = <nodes.Declaration> expression.findParent(nodes.NodeType.Declaration); var declaration = <nodes.Declaration> expression.findParent(nodes.NodeType.Declaration);
if (!declaration) { if (!declaration) {
this.getTermProposals(result); this.getTermProposals(result);
...@@ -563,7 +565,12 @@ export class CSSIntellisense { ...@@ -563,7 +565,12 @@ export class CSSIntellisense {
return result; return result;
} }
public getCompletionsForFunctionArguments(arg: nodes.FunctionArgument, result: Modes.ISuggestion[]): Modes.ISuggestion[] { public getCompletionsForFunctionArgument(arg: nodes.FunctionArgument, func: nodes.Function, result: Modes.ISuggestion[]): Modes.ISuggestion[] {
if (func.getIdentifier().getText() === 'var') {
if (!func.getArguments().hasChildren() || func.getArguments().getChild(0) === arg) {
this.getVariableProposalsForCSSVarFunction(result);
}
}
return result; return result;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册