Merge pull request #28 from adelphes/kotlin-support

add basic support for kotlin source files
This commit is contained in:
Dave Holoway
2018-05-06 20:13:24 +01:00
committed by GitHub
3 changed files with 6 additions and 3 deletions

View File

@@ -35,6 +35,9 @@
"breakpoints": [ "breakpoints": [
{ {
"language": "java" "language": "java"
},
{
"language": "kotlin"
} }
], ],
"debuggers": [ "debuggers": [

View File

@@ -479,7 +479,7 @@ class AndroidDebugSession extends DebugSession {
package: pkgname, package: pkgname,
package_path: fpn, package_path: fpn,
srcroot: path.join(app_root,src_folder), srcroot: path.join(app_root,src_folder),
public_classes: subfiles.filter(sf => /^[a-zA-Z_$][a-zA-Z0-9_$]*\.java$/.test(sf)).map(sf => sf.match(/^(.*)\.java$/)[1]) public_classes: subfiles.filter(sf => /^[a-zA-Z_$][a-zA-Z0-9_$]*\.(?:java|kt)$/.test(sf)).map(sf => sf.match(/^(.*)\.(?:java|kt)$/)[1])
} }
} }
// add the subfiles to the list to process // add the subfiles to the list to process
@@ -594,7 +594,7 @@ class AndroidDebugSession extends DebugSession {
// create a fake pkginfo to use to construct the bp // create a fake pkginfo to use to construct the bp
pkginfo = { srcroot:this._android_sources_path } pkginfo = { srcroot:this._android_sources_path }
} }
if (!pkginfo || !/\.java$/i.test(srcfpn)) { if (!pkginfo || !/\.(java|kt)$/i.test(srcfpn)) {
// source file is not a java file or is outside of the known source packages // source file is not a java file or is outside of the known source packages
// just send back a list of unverified breakpoints // just send back a list of unverified breakpoints
response.body = { response.body = {

View File

@@ -525,7 +525,7 @@ Debugger.prototype = {
}, },
_splitsrcfpn: function (srcfpn) { _splitsrcfpn: function (srcfpn) {
var m = srcfpn.match(/^\/([^/]+(?:\/[^/]+)*)?\/([^./]+)\.java$/); var m = srcfpn.match(/^\/([^/]+(?:\/[^/]+)*)?\/([^./]+)\.(java|kt)$/);
return { return {
pkg: m[1].replace(/\/+/g, '.'), pkg: m[1].replace(/\/+/g, '.'),
type: m[2], type: m[2],