在PhpStorm中添加包含项目到项目(Add containing folder to project in PhpStorm)

编程入门 行业动态 更新时间:2024-10-23 07:37:04
在PhpStorm中添加包含项目到项目(Add containing folder to project in PhpStorm)

我正在为Moodle开发一个插件,并在我的Moodle安装中创建了一个项目。 我正在扩展一个名为block_base的类,但PhpStorm表示undefined class block_base 。 我的猜测是因为所有moodle文件(包括类block_base )都不在项目文件中。

如何将其添加到项目文件中? 我可以简单地让整个Moodle安装项目,但我不希望这样,因为我正在使用GitHub,然后我必须将所有Moodle文件放在那里,这是毫无意义的。

I'm developing a plugin for Moodle and created a project inside my Moodle installation. I'm extending a class called block_base but PhpStorm says undefined class block_base. My guess is that is because all the moodle files (including the class block_base) aren't in the project files.

How do I add this to the project files? I could just simply make the entire Moodle installation the project but I don't want that because i'm using GitHub and I then have to put all of the Moodle files on there as well and that is just pointless.

最满意答案

PHPStorm可以在一个项目中处理多个git根(这就是我管理插件的方式)。

所以,你可以做到以下几点:

查看主要Moodle回购的副本(来自git@github.com:moodle/moodle.git) 将您的插件(包括.git子目录)放在Moodle代码中的正确位置 将整个Moodle代码设置为PHPStorm的项目 转到文件>设置>版本控制 通常PHPStorm将(在对话框的底部)显示检测到的git根列表,您只需单击“添加根”即可。 如果没有,请单击右侧的“+”并添加插件的路径。

现在,您可以对插件进行更改和更新,而无需检查Moodle的完整副本(作为额外的奖励,它可以很容易地获取最新的Moodle代码,因此您可以测试您的插件以防升级) 。

PHPStorm can handle multiple git roots within a single project (this is how I manage my plugins).

So, you can do the following:

Check out a copy of the main Moodle repo (from git@github.com:moodle/moodle.git) Put your plugin (including the .git subdirectory) in the correct place in the Moodle code Set the whole of the Moodle code as the project for PHPStorm Go to File > Settings > Version Control Usually PHPStorm will (at the bottom of the dialog) display a list of detected git roots and you can just click 'Add root'. If not, click on the '+' on the right and add the path for your plugin.

Now, you can make changes to your plugin and update, without having to check in a full copy of Moodle (as an added bonus, it makes it nice and easy to pull the latest Moodle code, so you can test your plugin against upgrades).

更多推荐

本文发布于:2023-07-25 19:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1265210.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:项目   PhpStorm   Add   project   folder

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!