rioj7 / my-code-actions Goto Github PK
View Code? Open in Web Editor NEWVisual Studio Code extension to define Code Actions grouped by LanguageID
Visual Studio Code extension to define Code Actions grouped by LanguageID
Hello, I have designed a code action in php, but it does not appear, instead, I have this:
I simplified the code action to see if it was a regex not matching, but that showed before keeps happening. This is the current code action:
"my-code-actions.actions": {
"[php]": {
"Add literal A to lang files": {
"diagnostics": ["Undefined class constant.*"],
"atCursor": "RPLC",
"file": "/profe.com/lang/lang_es_ES.ini",
"where": "start",
"insertFind": "",
"text": "{{diag:$1}} = {{atCursor:$1}}\n"
}
},
}
What is the problem?
If using diagnostics
and atCursor
, the diagnostics
capture groups are known and could be used in the atCursor
string.
"atCursor": "{{diag:$1}};\\s*\\?>([^<\"']+)"
After installing the extension and adding
"my-code-actions.actions": {
"[html]": {
"Create function {{atCursor:$1}}": {
"file": "${fileBasenameNoExtension}.ts",
"atCursor": "\\(click\\)=\"([^\"]+)\\(\\)\"",
"text": "function {{atCursor:$1}}() {\n}\n\n"
}
}
}
to the settings file it shows the option to create the function but when I click on it, it does nothing. Am I doing something wrong?
I found your extension through your great answer here on SO.
Similar to the OP on that question I'm trying to add a new function to an Angular typescript class when clicking on the click handler in the corresponding html file. However, using your suggestion settings the function appears at the very top of the file, which breaks the code.
Ideally (for me) I would like it to appear at the end, but inside the class; i.e. the last function in the class. Assuming I had only one class in the file I'm thinking a "where":"beforeLast"
option would work if I had "insertFind":"}"
.
Does this make sense or do you have a better suggestion for inserting the new function at the end of the class?
I.e.
import xxx;
import yyy;
@Component({
selector: 'about',
templateUrl: './about.component.html',
styleUrls: ['./about.component.css']
})
export class AboutComponent {
constructor() {
}
function() {
somecode;
}
newlyInsertedFunction() {
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.