-
Notifications
You must be signed in to change notification settings - Fork 632
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
vue: a new parser (partially implemented) #1581
base: master
Are you sure you want to change the base?
Conversation
This is a stub. Following must be solved. * parsing "export default" in <script></script> ara, and * choosing a guest parser dynamically. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Just for evaluating vue parser. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
It seems that
|
i have make error
my python is 3.6, i make a soft link to solve this. These seems like a bug in configuration about the python path |
some plugins like tagbar in vim will not list tags of kinds unless they are list in |
What is the shebang line on your |
after i install the latest version from homebrew for one time, the make error is automatically solved, i don't know why... |
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
To minimize a parser accessing kindDefinition data type, this commit changes the type `kind' and `extensions.scopeKind' fields to int. With this change, a parser can inspect a tagEntryInfo made in another parser. In other word, communication between parsers via tagEntryInfo is much easier. Actuall example will be shown in the communiation between JavaScript parser and VueJavaScript parser. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
#1584 is needed to write VueJavaScript parser which focuses only on the first level keys in 'export default' block. JavaScript parser notifies all tags captured in the parser to VueJavaScript sub parser. For showing my idea, I will push the changes in #1584, I will merge to the branch I proposed in this #1581. |
Input (foo.vue): 1 <template> 2 <div class="example">{{ msg }}</div> 3 </template> 4 5 <script> 6 import _ from 'underscore' 7 import MTableRow from './m-table-row' 8 let eachColumn = { 9 'data': [], // do not want to match this! 10 'subfields': {}, 11 } 12 13 function abyb (a, b) { 14 15 } 16 17 export default { 18 name: 'm-table', 19 props: { 20 'data': { 21 'type': [Object], 22 'default': function () { 23 return { 24 'columns': [], 25 'fixColumnCount': null 26 } 27 } 28 } 29 }, 30 data () { // want to match this 31 return { 32 'addable': false, 33 'deletable': false 34 } 35 }, 36 computed: { 37 style () { 38 }, 39 headerIDStr: { 40 cache: false, 41 get () { 42 } 43 } 44 }, 45 'methods': { 46 initData () { 47 }, 48 getColumn (index) { 49 }, 50 getColumnShow (index) { 51 }, 52 updateColumnSort () { 53 }, 54 getData (data, index) { 55 }, 56 updateRowSort (sortBy) { 57 }, 58 onMouseOverHeader () { 59 } 60 }, 61 created () { 62 this.initData() 63 }, 64 components: {MTableRow} 65 } 66 </script> 67 68 <style> 69 .example { 70 color: red; 71 } 72 </style> 73 74 <custom1> 75 This could be e.g. documentation for the component. 76 </custom1> Output with "./ctags --sort=no --fields=+lKn --extras=+g -o - foo.vue | grep -v language:JavaScript" name foo.vue /^ name: 'm-table',$/;" property line:17 language:VueJavaScript class:default data foo.vue /^ 'data': {$/;" class line:19 language:VueJavaScript class:default.props props foo.vue /^ props: {$/;" class line:18 language:VueJavaScript class:default data foo.vue /^ data () { \/\/ want to match this$/;" method line:29 language:VueJavaScript class:default style foo.vue /^ style () {$/;" method line:36 language:VueJavaScript class:default.computed headerIDStr foo.vue /^ headerIDStr: {$/;" class line:38 language:VueJavaScript class:default.computed computed foo.vue /^ computed: {$/;" class line:35 language:VueJavaScript class:default initData foo.vue /^ initData () {$/;" method line:45 language:VueJavaScript class:default.methods getColumn foo.vue /^ getColumn (index) {$/;" method line:47 language:VueJavaScript class:default.methods getColumnShow foo.vue /^ getColumnShow (index) {$/;" method line:49 language:VueJavaScript class:default.methods updateColumnSort foo.vue /^ updateColumnSort () {$/;" method line:51 language:VueJavaScript class:default.methods getData foo.vue /^ getData (data, index) {$/;" method line:53 language:VueJavaScript class:default.methods updateRowSort foo.vue /^ updateRowSort (sortBy) {$/;" method line:55 language:VueJavaScript class:default.methods onMouseOverHeader foo.vue /^ onMouseOverHeader () {$/;" method line:57 language:VueJavaScript class:default.methods methods foo.vue /^ 'methods': {$/;" class line:44 language:VueJavaScript class:default created foo.vue /^ created () {$/;" method line:60 language:VueJavaScript class:default components foo.vue /^ components: {MTableRow}$/;" property line:63 language:VueJavaScript class:default .example foo.vue /.example {$/;" class line:68 language:CSS TODO: The "grep -v" should be able to be removed when "--languages=-JavaScript" is passed. CAVEAT: The order of tags are expected, not a bug. TODO: This implementation tracks the level two keys in "export default". Though @Fmajor dosn't want ctags to track structures too deep, I wonder such truncating is a job of ctags or not. Such things can be done with clinet tools. TODO: It seems that export keyword is not a part of JavaScript yet. Transpilers handle it. However, it will be nice if JavaScript parser supports it. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
See 61d77c8. |
great! get what i want. |
now i get
can you add the kinds into |
I am trying to add a flag to mline and mtable parsrers launching a guest parser from a host parser defined in an option file.
|
Continuation of universal-ctags#1581. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Continuation of universal-ctags#1581. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Continuation of universal-ctags#1581. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Continuation of universal-ctags#1581. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
This is a stub. Following must be solved.
Signed-off-by: Masatake YAMATO yamato@redhat.com