dd-trace-php icon indicating copy to clipboard operation
dd-trace-php copied to clipboard

IDE auto-complete when using extension

Open dcsg opened this issue 6 years ago • 4 comments

Right now if I do have the extension loaded and if I require the package via composer it does not work together because of the autoloader.

In order to fix this and have auto-complete in my IDE (Intellij IDEA or PHPStorm) I need to have stubs or a plugin that provides them. I didn't saw any stubs available is there a way to provide them? Or any other suggestion to make this work?

dcsg avatar Nov 26 '19 13:11 dcsg

You could tease out the functions from this project

find -regex '.*/.*\.\(c\|h\)$' -exec cat {} \; 2>/dev/null | egrep -o "\bdd_\w+\(\)" | sort -u | sed "s/.*/function & {}/"

which yields:

function dd_trace_check_memory_under_limit() {}
function dd_trace_closed_spans_count() {}
function dd_trace_compile_time_microseconds() {}
function dd_trace_dd_get_memory_limit() {}
function dd_trace_forward_call() {}
function dd_trace_peek_span_id() {}
function dd_trace_pop_span_id() {}
function dd_trace_push_span_id() {}
function dd_tracer_circuit_breaker_can_try() {}
function dd_tracer_circuit_breaker_close() {}
function dd_tracer_circuit_breaker_consecutive_failures() {}
function dd_tracer_circuit_breaker_is_closed() {}
function dd_tracer_circuit_breaker_last_failure_timestamp() {}
function dd_tracer_circuit_breaker_open() {}
function dd_tracer_circuit_breaker_opened_timestamp() {}
function dd_tracer_circuit_breaker_register_error() {}
function dd_tracer_circuit_breaker_register_success() {}
function dd_tracer_circuit_breaker_total_failures() {}
function dd_trace_send_traces_via_thread() {}
function dd_trace_serialize_msgpack() {}
function dd_trace_set_trace_id() {}
function dd_trace_tracer_is_limited() {}

This can be added to a stubs include or using this project: https://github.com/JetBrains/phpstorm-stubs

RowdyElectron avatar Apr 03 '20 19:04 RowdyElectron

@dcsg confirming this resolved this for you? Going to close out in meantime but please let us know if you have any questions.

andrewsouthard1 avatar Jun 16 '20 00:06 andrewsouthard1

I didn't tried it yet. But it would be nice if Datadog provided this into phpstorm.

dcsg avatar Jun 18 '20 08:06 dcsg

For phpstrom you should push PR here: https://github.com/JetBrains/phpstorm-stubs

tmotyl avatar Dec 01 '20 09:12 tmotyl

Added by PR #1942, included in release 0.85.0 #1969.

PROFeNoM avatar Mar 29 '23 07:03 PROFeNoM