I am a lawyer, but not a Portuguese one, so you should definitely check with a Portuguese one, but I think you should be able to “get credit” for the time under either your D7 or GV.
The relevant portions of the law (Article 6) and the regulations implementing the law (Article 19) both just say that you have resided in PT for at least the required number of year (currently 5, but was 6 prior to 2018), and do not distinguish between types of visas. (And the GV counts as “residing” even though it’s only 7 days/year on average).
Organic Law No. 2/2018 - ARTICLE 6 - Requirements
1 - The Government may grant Portuguese nationality, by naturalization, to foreigners who cumulatively meet the following requirements:
a) Be of legal age or emancipated under Portuguese law;
b) Have resided for at least six years in Portuguese territory or under Portuguese administration;
c) Have sufficient knowledge of the Portuguese language;
d) Have moral and civil integrity;
e) Possess the capacity to govern their person and ensure their livelihood.
Portuguese nationality regulation - Article 19 - Naturalization of foreigners residing in Portuguese territory
1 - The Government grants Portuguese nationality, by naturalization, to foreigners when they satisfy the following requirements:
a) They are older or emancipated under Portuguese law;
b) They have legally resided in Portuguese territory for at least six years;
c) Know the Portuguese language sufficiently, in accordance with the provisions of article 25;
d) They have not been convicted, with final judgment of the sentence, for committing a crime punishable by a maximum prison sentence of three years or more, according to Portuguese law.
e) Do not constitute a danger or threat to national security or defense, due to their involvement in activities related to the practice of terrorism, under the terms of the respective law.