Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task]: Add code action support for regular expressions #38568

Closed
TharushiJay opened this issue Nov 4, 2022 · 2 comments · Fixed by #39509
Closed

[Task]: Add code action support for regular expressions #38568

TharushiJay opened this issue Nov 4, 2022 · 2 comments · Fixed by #39509
Assignees
Labels
Area/CodeAction Language Server Code Actions Lang/Regexp Issues related to Ballerina regular expressions Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Task

Comments

@TharushiJay
Copy link
Contributor

TharushiJay commented Nov 4, 2022

Description

The following code actions don't work with regular expressions. Identify and fix if there are any other similar code actions.

  1. Create function code action

string:RegExp regex = getRegex();

  1. Change variable type code action

string regex2 = re ``;

  1. Change return type code action
function test() returns string {

    return re ``;
}
  1. Fill record fields code action and completion item
type rec record {|
    string:RegExp regex;
    string str;
|};

function test() {
    rec r = {};

}

Describe your task(s)

No response

Related area

-> Editor

Related issue(s) (optional)

#38095

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@TharushiJay TharushiJay added Type/Task Team/LanguageServer Language Server Implementation related issues. #Compiler Area/CodeAction Language Server Code Actions labels Nov 4, 2022
@pcnfernando pcnfernando added the Lang/Regexp Issues related to Ballerina regular expressions label Nov 23, 2022
@mohanvive
Copy link
Contributor

Same with create variable code action,

[Error - 3:04:24 PM] CodeAction 'CreateVariableCodeAction' failed! {, error: 'Symbol is 'null''}
java.lang.IllegalArgumentException: Symbol is 'null'
	at io.ballerina.compiler.api.impl.SymbolFactory.getBCompiledSymbol(SymbolFactory.java:148)
	at io.ballerina.compiler.api.impl.symbols.BallerinaTypeReferenceTypeSymbol.definition(BallerinaTypeReferenceTypeSymbol.java:116)
	at io.ballerina.compiler.api.impl.symbols.BallerinaTypeReferenceTypeSymbol.getModule(BallerinaTypeReferenceTypeSymbol.java:134)
	at io.ballerina.compiler.api.impl.symbols.BallerinaTypeReferenceTypeSymbol.signature(BallerinaTypeReferenceTypeSymbol.java:169)
	at org.ballerinalang.langserver.common.utils.FunctionGenerator.generateTypeSignature(FunctionGenerator.java:51)
	at org.ballerinalang.langserver.codeaction.CodeActionUtil.getPossibleTypeSymbols(CodeActionUtil.java:312)
	at org.ballerinalang.langserver.codeaction.CodeActionUtil.getPossibleTypes(CodeActionUtil.java:195)
	at org.ballerinalang.langserver.codeaction.providers.createvar.CreateVariableCodeAction.getCreateVariableTextEdits(CreateVariableCodeAction.java:155)
	at org.ballerinalang.langserver.codeaction.providers.createvar.CreateVariableCodeAction.getCodeActions(CreateVariableCodeAction.java:94)
	at org.ballerinalang.langserver.codeaction.CodeActionRouter.lambda$getAvailableCodeActions$4(CodeActionRouter.java:137)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.ballerinalang.langserver.codeaction.CodeActionRouter.lambda$getAvailableCodeActions$5(CodeActionRouter.java:127)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at org.ballerinalang.langserver.codeaction.CodeActionRouter.getAvailableCodeActions(CodeActionRouter.java:123)
	at org.ballerinalang.langserver.codeaction.BallerinaCodeActionExtension.execute(BallerinaCodeActionExtension.java:49)
	at org.ballerinalang.langserver.codeaction.BallerinaCodeActionExtension.execute(BallerinaCodeActionExtension.java:37)
	at org.ballerinalang.langserver.LangExtensionDelegator.codeActions(LangExtensionDelegator.java:169)
	at org.ballerinalang.langserver.BallerinaTextDocumentService.lambda$codeAction$8(BallerinaTextDocumentService.java:334)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

@LakshanWeerasinghe LakshanWeerasinghe self-assigned this Jan 25, 2023
@LakshanWeerasinghe LakshanWeerasinghe moved this from BackLog to In Progress in Ballerina Team Main Board Jan 25, 2023
@LakshanWeerasinghe
Copy link
Contributor

Need to add this as well #39249.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/CodeAction Language Server Code Actions Lang/Regexp Issues related to Ballerina regular expressions Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Task
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants