Visual Studio Code,在外部应用程序中打开当前文件

时间:2016-01-31 15:21:28

标签: typescript visual-studio-code electron

我正在尝试在Visual Studio Code中编写一个简单的扩展,扩展将简单地获取当前文件并在外部应用程序中启动它。我们怎么能这样做?

2 个答案:

答案 0 :(得分:3)

使用VS Code Tasks找到答案。如果某人有使用扩展程序的解决方案,我们将不胜感激。

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                ClockWiseRotation window = new ClockWiseRotation();
                window.frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

/**
 * Create the application.
 */
public ClockWiseRotation() {
    initialize();

}

/**
 * Initialize the contents of the frame.
 */
private void initialize() {

    timer = new Timer(1000, new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            second = Integer.toString(Integer.parseInt(handle.getText()) + 1);
            for (int i = 33; i <= 60; i++) {
                int angle = i * (360 / 60);
                handle.setBounds((int)(202 + 100 * Math.cos(angle)),
                        (int)(119 + 100 * Math.sin(angle)), 23, 26);

            }
            handle.setText(second);

        }
    });
    timer.start();

    frame = new JFrame();
    frame.setBounds(100, 100, 450, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    handle = new JTextField();
    handle.setText("0");
    handle.setBounds(202, 22, 23, 26);
    frame.getContentPane().add(handle);
    handle.setColumns(10);

    JComboBox centerPoint = new JComboBox();
    centerPoint.setBounds(202, 119, 17, 20);
    frame.getContentPane().add(centerPoint);

}

答案 1 :(得分:1)

您可以使用node / npm上可用的任何内容。在您的情况下,您可以使用git <options> | perl -p -e 's/\t/^I/g' | less https://nodejs.org/api/child_process.html

另外,您可以使用我个人喜欢的spawn 前台流程启动https://www.npmjs.com/package/open