K2JS: fix breakpoints when use JavaScript debugger.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="com.jetbrains">
|
||||
<javaScriptBreakpointAware implementation="org.jetbrains.kotlin.idea.debugger.KotlinJavaScriptBreakpointAware"/>
|
||||
<javaScriptDebugAware implementation="org.jetbrains.kotlin.idea.debugger.KotlinJavaScriptDebugAware"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.debugger;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.PairProcessor;
|
||||
import org.jetbrains.kotlin.idea.JetFileType;
|
||||
import org.jetbrains.kotlin.idea.project.ProjectStructureUtil;
|
||||
|
||||
public class KotlinJavaScriptBreakpointAware implements PairProcessor<VirtualFile, Project> {
|
||||
@Override
|
||||
public boolean process(VirtualFile file, Project project) {
|
||||
if (file.getFileType() == JetFileType.INSTANCE) {
|
||||
Module module = ModuleUtilCore.findModuleForFile(file, project);
|
||||
if (module != null) {
|
||||
return ProjectStructureUtil.isJsKotlinModule(module);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.debugger;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.JavaLineBreakpointType;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointType;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpointType;
|
||||
import com.jetbrains.javascript.debugger.JavaScriptDebugAware;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class KotlinJavaScriptDebugAware extends JavaScriptDebugAware {
|
||||
@Nullable
|
||||
@Override
|
||||
public FileType getFileType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public XLineBreakpointType<?> getBreakpointTypeClass(@NotNull Project project) {
|
||||
return XBreakpointType.EXTENSION_POINT_NAME.findExtension(JavaLineBreakpointType.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user