There is no option to "Mark Directory as"

已回答

My project directory has a subdirectory "run/" with an obscenely large number of files that may change rapidly. (they are outputs of a computation).  Whenever the contents of this directory changes, I see CLion dutifully scanning them (with a visible progress bar at the bottom of the interface).

I would like to mark this directory as "Excluded" as I have been able to do in the past on other projects; but for some reason, the option is not there this time.

 

2

Hello! I assume, these folders are Rust or Python packages. Unfortunately, for now in CLion it's not possible to "Mark Directory as..." when CMake is not loaded. Please see https://youtrack.jetbrains.com/issue/CPP-13158 and https://youtrack.jetbrains.com/issue/CPP-13494. Feel free to comment or upvote these issues, follow them to get updates. 

1

Ah, funny, because the project where it *works* for me is a Rust project!  But sure enough, if I just make a new Rust crate and start clion there, the option is not there.  I wonder why it only works in that one project...

In said project where it works:

* There is no CMakeLists.txt
* Under Settings > Build, Execution, Deployment > CMake, the "Automatically reload..." box is unticked, and the Profiles list is empty.
* When I run a Run Configuration or use Ctrl+F9 to build, no unsightly cmake-build-debug directory appears.
* ...but there is a Tools > CMake dropdown in the main menu, and there is a CMake console (both of which are missing on the other projects). The console has a single harmless error message:

> [No CMake profiles]CMakeLists.txt not found in /home/lampam/cpp/other/rust/rsp2/. Select CMakeLists.txt file...

I wonder what could be so different about that project that has tricked CLion into thinking it is a CMake project (but without all the downsides of a CMake project!)?

0

Have you created this "working" Rust project using CLion (I mean, inside CLion)? 

0
Avatar
Permanently deleted user

I have the exactly same problem with a Rust project. I've been able to create a scope which excludes the problematic directory, but it seems to only affect Project tool window, not the indexing.

Is there a workaround to exclude a specific directory from the index? E.g. editing some xml under .idea/?

0

@Randi, I'm afraid there is no workaround for now. Please comment or upvote https://youtrack.jetbrains.com/issue/CPP-13494.

-1

This is a super old question, but I ran into the same problem with CLion 2019.1 and the rust plugin. There is a workaround, add the tags <excludedFolder url="file://$MODULE_DIR/whathever_you_want_to_exclude" /> under the content in the component tag of the file YOUR_PROJECT_NAME.iml.

Example of PROJECT_NAME.iml file with excluded directories:

<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
  <component name="NewModuleRootManager">
    <content url="file://$MODULE_DIR$">
      <excludeFolder url="file://$MODULE_DIR$/data" />
      <excludeFolder url="file://$MODULE_DIR$/target" />
    </content>
    <orderEntry type="inheritedJdk" />
    <orderEntry type="sourceFolder" forTests="false" />
  </component>
</module>
1

I managed to solve this by opening my project in PyCharm and marking the directories there.  This modifies the same .iml file which CLion uses.  CLion was then  able to resolve references to my Python code.  This would, presumably, work for other languages as well.

It's pretty clear that the various JetBrains IDEs (CLion, PyCharm, WebStorm, IDEA, etc.) are just different flavors of the same core program.  They were probably split off and branded individually in order to increase sales numbers.  It would be really great to have a unified IDE for full-subscription customers instead of forcing us to jump between editors for specific features like this.

1

@Nthexwn, feel free to comment or upvote a feature request about making CLion available as IntelliJ plugin: https://youtrack.jetbrains.com/issue/CPP-4141.

0

You people HAVE GOT TO BE KIDDING ME. I opened the directory in WebStorm, the option was there to mark the directory as excluded; immediately CLion noticed this and acted accordingly.

` Unfortunately, for now in CLion it's not possible to "Mark Directory as..." when CMake is not loaded.`

... clearly WebStorm was able to do this without problem and CLion accepts it just fine.

Why are you playing such stupid games with your paying customers??

Reported June 2018 and now it is February 2020. This cannot possibly be that difficult to fix. 

6

@...'s workaround works. Edit .idea/[whatever-your-project-name-is].iml and add the exclusions manually.

 

0

This is a big pain point for me. I am hitting it when opening a python project in CLion version 2020.2. I bought CLion to work on mixed python/Rust projects. 

0

@Nthexwn That solution works great, very simple. Pycharm is free and it is very easy to exclude a directory. You can have the same project open in both, exclude it in Pycharm and it is automatically excluded in CLion. Annoying they decided not to bring this very minor, already built feature into CLion. It clearly works and the file formats are the same. Also, I agree, I would love one IDE to rule them all. 

0

I'm running 2021.2. I have a project that uses CMake and I don't see the option to mark a directory as excluded. I see other options beneath "Mark Directory as ...", "Project Sources and Headers", "Library Files", and "Python Namespace Package". But not "Excluded". I don't know when this feature went away.

0

@... maybe you faced https://youtrack.jetbrains.com/issue/CPP-26013. Please comment or upvote the issue in order to get updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack. 

Sorry for the inconvenience.

0

请先登录再写评论。