Why is my microcontroller not shown in MPLAB® X IDE?
You can see which microcontrollers are supported by which programmers at C:/ProgramFiles(x86)/Microchip/MPLABX/vx.xx/docs/DeviceSupport.htm (path may vary depending on your MPLAB® X IDE version)
For example, the PIC18F27K40 is supported by v1.38 of the MPLAB XC8 compiler. Older XC8 versions do not fully support or do not support this device at all.